How to use lm inside a for loop for different variables