for(something){ open file get info write info to file close file } #### open file for(something){ get info write info to file } close file