If you do have an operating system on your mac and it is functioning then you can download
El Capitan using this method.
How to upgrade to OS X El Capitan – Apple Support
Go to Section 4 and click on Download OS X El Capitan.
This downloads InstallMacOSX.dmg to your Downloads folder.
When downloaded open to InstallMacOSX.pkg, double-click on
that and an installation window will open, this does not install El Capitan
but converts the .pkg to the Install OS X El Capitan.app which you will find in
your Applications folder, it should be 6.2GBs in size.
(the creation of the Install OS X El Capitan.app can only be done on a mac that is
capable of running El Capitan, so any mac that came preinstalled with an OS
newer than El Capitan will not be able to do it.)
If the installation window asks which disk you want to install to, you must pick
the disk that you are booted to at the time. Not any internal or external disk that
you want to eventually install El Capitan on, that is for later.
If you want to create a bootable USB stick then keep the Install OS X El Capitan.app in the Applications folder and follow the instructions in this article,
How to create a bootable installer for macOS – Apple Support