Writing to file code completed