Finished code for creating file