output to files during iterations