Fixing the errors in your robots.txt file depends on the platform that you use. If you use WordPress, it is advisable to use a plugin such as WordPress Robots.txt Optimization or Robots.txt Editor. If you connect your website to Google Search Console, you’re also able to edit your robots.txt file there.
Some website builders like Wix don’t allow you to edit your robots.txt file directly but do allow you to add no-index tags for specific pages.