That sounds like the starter solenoid. If the known good batteries didn't work, check the connection to starter...the cable under +terminal under hood goes directly to it. Remove nut and look underneath for corrosion. Otherwise, the starter is near the firewall...and those repeat clicks is what I got when my car's battery died on me. Check for tightness, corrosion on all parts of the electric system from battery to starter...ground to body in trunk by the battery...engine ground straps.
Upcoming comedy shows: May 20, Greenwich Village Comedy Club. 6 p.m. See Facebook for other shows and PM me if you can make one...love to see you there!
A recent set: https://youtu.be/995gLmVEVZk
Mangofy your E46!