First checkin of write_to_file