sudo /Applications/Install\ OS\ X\ El\ Capitan.app/Contents/Resources/createinstallmedia --volume /Volumes/MyVolume --applicationpath /Applications/Install\ OS\ X\ El\ Capitan.app
The path above is the default command that Apple quotes here,
How to create a bootable installer for macOS – Apple Support
Your command should work as long as you have these items in the correct places, the USB should be plugged
directly to your mac, no USB hubs.
Do you have the Install OS X El Capitan.app in your Applications folder and do you have a USB stick called OSX mounted on your Desktop.
When did you download the Install OS X El Capitan.app, if it was before October 2019 then it may not work as the certificate for it has now expired. Apple did release an updated version with a valid certificate which you can download from here,
How to upgrade to OS X El Capitan – Apple Support
This follows a different procedure where by you initially download a file called InstallMacOSX.dmg
to your Downloads folder. You would open that to get InstallMacOSX.pkg.
The next stage of the process can only be done on a mac that can run El Capitan, a mac that came pre installed with
a newer OS like Sierra onwards will refuse to do this.
Double-click on InstallMacOSX.pkg this opens an installation window, which does not install El Capitan
but creates the Install OS X El Capitan.app in your Applications folder.