move print to file out of loop to eleminate identical entries