Save function

Write the data into a txt file