What is the exact model of your Mac? You can get this information by clicking on the Apple menu and selecting "About this Mac" or by entering your serial number here or here.
In order to access the App Store you need to make sure you have all of the macOS 10.9.5 security patches installed.
If you have a 2011 Mac, then you should be able to access the macOS 10.11 El Capitan installer since it is now available outside of the App Store plus it may be necessary to upgrade to 10.11 before upgrading further to 10.13. Here is an Apple article with links and instructions (read the instructions carefully as there are several steps to extracting the 10.11 installer to the Applications folder):
https://support.apple.com/en-us/HT211683
I recommend you create a bootable macOS USB installer using these instructions:
https://support.apple.com/en-us/HT201372
I highly recommend you have a good backup before attempting to upgrade macOS just in case something goes wrong.