Updated printing to the output file