Answer: The temperature increases when energy in is greater than energy out, and temperature decreases when energy out is greater than energy in.
This is a question about the earth's energy balance. The incoming energy we get comes from the sun, some of that is used and another fraction returnes to space.
So if the energy that come in is more that what comes out, we will have more energy and that rises the temperature. The opposite also happens, temperature decreases when energy that comes out is greater than the incoming energy.