Reptiles are called cold-blooded animals: why? The answer is very simple: they are (as well as the invertebrates, the fishes and the amphibians) ectotherm animals, that is, not able to regulate their own body temperature, which therefore depends on the environmental one.
The word thermoregulation means indeed the ability of organisms to increase or reduce their body temperature, depending on environmental factors.
While mammals and birds (called homeotherms) are able to regulate their temperature (also thanks to the fur and feathers!), for reptiles (as well as for invertebrates, fish and amphibians) this can only be done by their behaviour: to increase body temperature, they expose themselves to the sun, and are forced to rest when the weather is not suitable, as in winter.
For this reason, they are looking for shelters such as dry stone walls, piles of stone or wood. These are indeed a shelter if there’s a danger, thanks to the many crevices where they are able to insert, but at the same time they can stay on rocks and stones that, heating, allow them to increase their body temperature.