See the 16.5.7 beta for a fix to the other problem you ran into, which was a failure to replace an ampersand with a valid entity character reference.
See if the Text Edit Note...
and Show in Finder
commands are working now. I’m not sure what the problem might have been previously, but those commands are working for me now.
In terms of your formatting issues, I wonder if Apple Books is trying to apply justified paragraph formatting to your text (meaning it’s trying to provide a nice neat straight right margin to all of the lines in your paragraphs other than the last)?