Here is an Apple article with instructions for downloading various macOS installers.
How to download and install macOS - Apple Support
At this time while running Yosemite, your only options are to download macOS 10.11 El Capitan or macOS 10.12 Sierra since Yosemite no longer has access to the App Store where the macOS 10.13+ installers are located.
If this laptop has any important data on it, then I highly recommend you make sure to have a good backup before attempting to upgrade the OS.
If this laptop at one point did have macOS 10.13+ installed at some point in the past, then try booting into Internet Recovery Mode using Command + Option + R to attempt to access the online macOS 12.x Monterey installer. To install macOS Monterey using Internet Recovery Mode will require having at least 45GB of Free storage space which is only shown in Disk Utility or the System Profiler. Ignore the "Available" value shown every where else since it is misleading and is not synonymous with Free.