How to write the data in the database table line by line to the text file, and add a separator to each field