Removing line breaks in Twig
The cause of the problem is probably not the template but how the field is configured in Views. You should be able to find a solution there, even if it means you need to rewrite the field output.
If you want to try solving it in this template you have to check what is inside of output. Views usually puts the field output in a markup object. Then you have to render it first before applying twig filters:
{{ output|render|striptags|trim }}

I've also added |striptags, otherwise you would see HTML tags in plain text on the screen because they are escaped by trim.