First, A1224 is not definitive enough. There are quite a few iMac models associated with "A1224":
https://everymac.com/ultimate-mac-lookup/?search_keywords=a1224
Given, though, that you stated yours is a 2007 model, I suspect it is one of the first 2 on that list. Which one is it?
Next, the maximum Mac OS either of those machines can run is El Capitan, OS 10.11.x (last version was V10.11.6). So, the USB stick you have with El Capitan on it should be fine.
Third, unfortunately you are not presently setup to do anything. What you need to do is 1) find a friend who has a "newer" Mac, 2) purchase a hard drive along with an external case, 3) connect the drive to your friend's Mac, and use Disk Utility there to Erase and Format the external drive, 4) use that USB stick and the (empty) drive inside the case on your friend's Mac to install El Capitan onto the drive, and 5) install the drive inside your iMac. The other way to do it is 1) find a friend who has a "newer" Mac (it will need to have a Firewire 800 port), 2) purchase a bare hard drive and install it inside your iMac, 3) connect the 2 Macs with a Firewire 800 cable, 4) boot your iMac in "Target Disk Mode", 5) Erase and Format the drive inside the iMac with Disk Utility on your friend's machine, 6) install El Capitan from the UDSB stick (plugged into a USB port on your friend's Mac), and finally 7) turn everything off, unplug everything, and then start up your iMac.
I am not aware of doing any such thing using your iPad.