When matter loses heat, one of the following happens:
Liquid changes to solid (freezing), or
Gas changes to liquid (condensation), or
Gas changes to solid (deposition)
1- Freezing: when the temperature of a liquid matter drops below its freezing point, the liquid usually solidifies forming crystals. Example of this is when water changes to ice
2- Condensation: when the temperature of gas is reduced, the molecules slow down and come together changing the matter into liquid. Example of this is when water vapor condenses into water droplets.
3- Deposition: Sometimes when the temperature of a gas drops, it solidifies directly without passing through the liquid phase. An example of this is when water vapor changes directly to ice in sub-freezing areas without passing through the liquid phase. This is the process through which clouds are formed.
The diagram below shows these three changes in matter.