prints output to file