print output to a file