kW is power [kJ/sec]. So it takes 21 kJ per second of energy (kilojoules). So yes, you're correct, it takes 21 kW of power to heat water flowing at 4 gallons/minute.