If you had previously downloaded Yosemite it should appear in the Purchased section of the App Store, before you attempt this
remove any external drives that have an existing copy of the Yosemite installer on it, the App Store can see these. Once you are confident your Mac has no Yosemite installers on it then you can download Yosemite, this copy should not have an expired certificate if that is the problem with the Yosemite installer you already have.
If the copy of Yosemite you already have has an expired certificate, there are ways of getting round this.
Open System Preferences> Date & Time> Date & Time uncheck Set date and time automatically. Now enter a date previous to the expiry of the installers certificate, try 2nd February 2016, now try installing your Yosemite app. If that date doesn't work then try another one earlier. If that works then when you boot into Yosemite you can change the date back to today and it should run perfectly well.
As for the progression of installing macOS's, if you try to download El Capitan, How to upgrade to OS X El Capitan - Apple Support from the App Store, you will be refused it if the App Store recognises that your Mac can upgrade higher.
Use this app to see if the apps you have will work in the newer OS's, https://roaringapps.com
Remember you can have Mavericks and all the apps you need on an external drive, and upgrade the OS on the internal drive so you can have the benefits of new security updates, and a more secure Safari.