mainly finish the write_table function and the next is to cut  an array