Role of earth
The land surface is not of the same everywhere. Also it is not uniform in composition. It can have rocky surfaces or sandy surfaces.
Try this out. Place two sheets of paper, one white and the other black in the sunlight. The white paper will feel cool after five minutes, but the black will feel quite warm. White and light-coloured things reflect light, that is, they let it bounce off. Black and dark-coloured things absorb light.
Dark-coloured places heat up more in the sunlight than lighter ones. And because the surface of the earth is dark in some places and light in others, the earth does not heat up evenly in the sunlight. The sunlight is absorbed by dark-coloured things, so that they heat up quickly. That is why the tar road (black) is hotter than the mud path beside the road.
Land and water
Water and land are not heated uniformly. Try this out.
Place the two in sunlight for fifteen minutes. Then touch the surface of the soil and of the water. You will find that the soil feels quite warm while water remains fairly cool. In the sunlight soil heats up faster than water.
The same is true of most materials. Sand, rock, wood cement, brick all heat up faster than water. But the water; in a lake or ocean stays cool. But at night, in the absence of the sun, notice that land cools off quicker than water. Take the same bowls and continue to measure their temperatures every hour after sundown.
When the sun sets, the land, cools off very quickly. But water cools slowly. So at night water feels warmer than the land, while in the daytime it's the other way around. Water heats up very little in the sunlight and cools off very little in the dark. Land heats up a great deal in the sunlight and cools off quickly in the dark.
That is the role of the sun. It heats up the ground and heats up the water but different things are heated differently. The earth’s surface is heated by the sun but not uniformly.
What do these facts have to do with weather?