You can use macOS Recovery to manually upgrade your computer to the latest compatible macOS version. This method requires an internet connection during the upgrade process and is only for major macOS releases.
To install the latest macOS version compatible with your computer, start up from macOS Recovery by turning on your computer and pressing Option-Command-R. If you want to erase the data on the computer before installing macOS, you can use the Disk Utility.
Note: On FileVault encrypted computers with macOS 10.15 or later, you must enter the password or the recovery key of the FileVault enabled user to access the recovery partition.
For more information on how to install macOS from macOS Recovery, see How to reinstall macOS from macOS Recovery from Apple's support website.