How can I write data into a file?