Atmoshpere of Earth is a bad conductor so acts as a temperature buffer. However, moonlacks an atmosphere around it. Therefore, moon gets heated up as sun rays fall on its surface. It cools down drastically when there is no sunlight, causing wide fluctautions in its temperature.