When high pressure is applied to a gas, space between the particles of the gas gets compressed, thereby reducing the spaces between the particles. This reduces its volume. In this way, the particles of the gas get so close together that they start attracting each other sufficiently to form a liquid. Now, when a gas is compressed too much, heat is produced due to compression. So, while applying pressure to liquefy a gas it is equally important to cool them to cool away the heat produced during compression. Cooling lowers the temperature of the compressed gas and helps in liquefying it.