controller generates a .txt file per iteration of while loop