writing to output.txt