Loop through posts? Want to remove extra newlines in actual post HTML/content on backend

Since there are no tags around the space   characters, they will be compressed on the page output.

So the visual output will not be affected. And a very minor effect on the database or processing of the post content.

If you are really concerned about the extra stuff, then you could use the_content filter to remove extra   in the content. But you would have to be careful that your filter didn’t remove   that really needed to be in the content.

Which is why I don’t think that the effort to remove is worth it, and may cause unexpected problems.

Added

If you really want to get rid of the extra spaces in the posts, then see the answer here, where the wp_insert_post_data filter is used. That filter fires when the post is saved via the editor.

You’ll just need to adjust the regex for the text you are looking to replace. Look at a example post in text editing mode to get the actual string to look for in the regex. (Regex is hard for the amatuer – and maybe the experts – but you might look at this Regex testing site to tweak your regex so it works: https://regex101.com/ . I like that site, because it explains things and also creates the PHP code needed to do the Regex.)