Transpiration does the same to plants as the sweat does to humans.
transpiration is the process of condensation where the water molecules evaporate.
when the water molecules transform into gas, bonds are broken. Heat energy is needed to break bonds.
so when evaporation of water occurs on a plant heat energy is absorbed leaving the plant to cool down. Thus transpiration helps the plant to prevent the overheating in plants.