This is the 2 nd law of thermodynamics. The second goal is to get heat out of the refrigerator. The warm gaseous refrigerant is cycled to the compressor where it is pressurized and heated. Again, pressure is proportional to temperature. In short, the temperature of the refrigerant is increased because the pressure is increased.
Heat can only move from warmer temperatures to cooler temperatures.
The artificially heated refrigerant gas is cycled to the condenser. These are the heat-exchanging tubes at the back of your refrigerator. The gas cools and condenses into liquid as the heat leaves. The cycle repeats with the cool liquid refrigerant shooting through the expansion valve etc. The expansion valve allows the cool liquid to expand and evaporate as a gas.