That was silly not making a backup before you decided to erase your mac.
It was also silly not to have downloaded and prepared a bootable USB installer
before you made a backup and erased your disk.
Do you have the Snow Leopard DVD, you must have installed Mac OS X Snow Leopard
at one point in this macs life as that is the only way you could have upgraded to Mac OS X El Capitan.
If you have the DVD for Snow Leopard you can install that, then update the version to 10.6.8 with this updater,
https://support.apple.com/kb/DL1399?viewlocale=en_US&locale=en_US
Having got to Snow Leopard 10.6.8 check the App Store for any more updates and install them.
Now you can download Mac OS X El Capitan, click on the link below.
How to get old versions of macOS – Apple Support (UK)
Go to the Download OS section and click on OS X El Capitan 10.11.
this downloads InstallMacOSX.dmg to your Downloads folder.
The next section can only be done on a mac that is capable of running El Capitan.
This includes macs that have the potential to run El Capitan but have been upgraded to a newer OS.
A mac that came preinstalled with an OS later than El Capitan will refuse to do the next bit.
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 InstallMacOSX.pkg to the Install OS X El Capitan.app which
you will find in your Applications folder, it should be 6.2GBs in size.
(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.)
To start the installation of El Capitan double click on the Install OS X El Capitan.app.
The copy of the install app self deletes after installing El Capitan, so make sure you keep a copy of the
InstallMacOSX.dmg if you need it in future, or you could just make a copy of the Install OS X El Capitan.app
prior to installing and moving it to an external drive for safe keeping.
It is also possible to create a bootable USB installer disk using the Install OS X El Capitan.app in the Applications
folder and the createinstallmedia command in the Terminal app.
Read the instructions here,
How to create a bootable installer for macOS – Apple Support
If you do not have the Snow Leopard DVD then your only other option is to borrow a mac to download
Mac OS X El Capitan as described above and then making a bootable USB installer which you use to
install on your 2008 mac.
Remember the donor mac needs to be a mac that is capable of running El Capitan as described in the
bold text above.