[9.18] fix: usr: Remove extra newline from yaml output
I split this into two commits, one for the actual newline removal, and one for issues I found, ruining the yaml output when some errors were outputted.
Closes: #4772 (closed)
Backport of MR !9112 (merged)