If an air conditioning unit has been designed for mounting in a window, the back part must be outside in order for the unit to function properly. These air conditioner units are designed to vent hot air out of the back.
The hot air produced by the air conditioner is the system's exhaust. If the hot air is not allowed to vent to the outside to dissipate, the heat it generates is likely to negate the work of the air conditioner. This overworks the air conditioner's condenser, which reduces the operating life of the unit, and it may also void the product warranty.