RE: Engineers repairing rail lines
As Ricky B already mentioned, rail lines can't be repaired.
However, provided rail capacity is available, units can leave rail mode, move to a non-damaged rail hex and switch to rail mode again regardless of whether the rail line can trace to a supply source or the edge of the map. That makes rail damage mostly inconvenient in scenarios where the attacker has rail capacity, though the defender could theoretically damage every rail hex.
In PzC, most if not all unit types can damage a rail line.
In FWWC, only engineers can damage a rail line.