Once the sun has heated water to the point where it has become a vapour in the air, this warm air then rises high into the atmosphere where temperatures are a lot colder. The air cools down and the vapour turns back into water (tiny droplets that together make clouds).
Condensation also happens right here on the ground. The same thing is happening when you pour out a glass of icy cold water from the fridge on a hot day. Water in the air that’s been heated up and turned into vapour suddenly hits the cold surface of the glass, cools down and turns back from vapour into water droplets.