Nope. They get the energy from the output of the engine. Since the water is a liquid, which is much denser than gas, it is easy to pump. Early locomotives just sprayed the resulting steam into the air, which meant they did not have to condense it - but they then ran out of water and had to stop after 50 miles or so to take on more water. Later locomotives recycled the water by using huge condensers to condense the steam back to water. (Google a picture of one; they took up a massive amount of space.) A compressor is a kind of pump, although a pump is not a compressor. Most pumps do not phase change the fluid they are working with, nor are they designed to significantly compress any gases they pump.