output to file & exit on break