add print to file and print flag