Add `\n` only when it *does not* end with `\n`.