Continuous loop that writes than reads a new file on each interation