Need some help with my code ,please

So if i change my "for" loop , will it correct the temperature spikes? I dont get it... :confused:

I am sorry im kinda noob to programming