How to save data in a program

Thank you. Do you also know how to add data from the programm into the txt file?