Dear Student,
Under Natural conditions heat flows from high temperature to low temperature by adding external work the reverse is possible.
condenser Rejects Heat
Compressor does the work while absorbing electrical energy
Work is done on the system hence heat is Rejected to higher temperature from lower temperature.(Principle).
Good Luck...!!!
Regds