loop should write all data files