The heat pump must have a way to release energy to the outside. Refrigerator as an example:
A refrigerator cannot cool the kitchen if the refrigerator door is left open.
The among of energy leaving the external coils behind or underneath the refrigerator is greater than the amount of energy removed from the food or from the air in the kitchen if the door is left open.
The difference between the energy out and the energy in is the work done by the electricity supplied to the refrigerator. Energy, Win, allows compressor to remove heat from inside the refrigerator and transfer it to the kitchen.