Hey Aniruddh,
It’s okay. Well as far as I can see you are stacking the preds but with which variable is a question? Plus it looks like the prediction variable sets to new value after each iteration. Just tell me one thing if you uncomment the previous line and comment this stack line are the answers still the same?