When a liquid is heated its molecules gain kinetic energy and at a certain stage (at the melting point) it changes to a liquid. The liquid when further heated changes into a gas at its boiling point. The gas doesn't change in any form further. When a gas is cooled, its molecules slow down and move closer together until they are attracted to each other to form a liquid. When a liquid is cooled the particles lose more energy and move about their fixed positions till they are attracted towards each other and form solid.