How to make the content written to Excel in a loop not overwritten by the previous one