Standardize the dataset

Generally, the scale() function can already be used for what you are doing, so there might not be a need to use a for loop.
However, without providing some information about your data and some of your own attempts to solve the problem, it is hard to give you any useful help. Have a look at this link: FAQ: How to do a minimal reproducible example ( reprex ) for beginners to read how you could give us this information.

In the meantime, you could have a look at the introduction to for loops in R for Data Science (chapter 21), there you can read a bit about for loops and some alternantives in R.