Adding printing to output file