split up training and write to file