Create solid horizontal lines in the .txt file
It's a menu option in TextEdit.  Point your mouse at Edit > Substitutions > Smart Dashes, which I'm guessing will not be ticked.  Click on it, and turn it on.

Now when you press and hold the hyphen key, they will be replaced with gapless dashes that will form the line you're after.

There's also some options relating to this in the main preferences pane of TextEdit, which I believe are used for the default settings for new documents being created:



So make sure Smart dashes is turned on by default.  And don't miss the very bottom checkbox, which you might want to uncheck so that you retain this sort of dash-forming hyphens in plain text as well as rich text documents.

Should, by some unfortunate circumstance, this not resolve your issue, leave a comment, and I can provide you with an alternative way to achieve the same thing.