heat in this case does 2 things: a) increase rate of reaction (as it does to all reactions in the world) b) increases yield (IIRC, since esterification is an endothermic reaction)
but reagents are volatile, as f3nr15 said. so you attach a condenser to condense all evaporated reagents.