Water heaters are pretty simple. There are two input lines and two output lines. One set of lines is the 'domestic' water, which means it comes in from your fresh water tank and goes out to the hot water lines (galley, head, etc.) The other lines are for engine supplied hot water. The water comes from the engine, goes through the water heater (where is goes through a heat exchanger, heating the domestic water) and out.
Regarding the 2nd set of lines. Did you mean: the water goes from the "water heater" to the "engine heat exchanger" back to the water heater? I assume when you drain the water heater, you are also draining the water out or the engine heat exhanger.