Changing some lines into a single line is done with paste -s.
In this case, you want to change four lines into a single line.
The four lines are created with seq 1 3; echo 4:
$ seq 1 3; echo 4
1
2
3
4
Pass these through paste -d ' ' -s - to convert them into a single line, delimiting each original line with a space character:
$ { seq 1 3; echo 4; } | paste -d ' ' -s -
1 2 3 4
You could pass the lines through tr '\n' ' ' instead of through paste -s, but this would also replace the final newline character with a space (the one after 4), which is probably not what you want to do.