Answer
U-shaped ends allow for heat related expansion and contraction of the pipes.
Work Step by Step
Steam pipes experience large temperature changes as the steam enters or leaves.
If a pipe were straight, and fixed at both ends, the large thermal expansions and contractions might crack the pipe or break the connections at the endpoints.
A U-shape takes up the stress, allowing the pipe to change length without putting a lot of force on the ends where it is connected.