You have to assume all the parts are over 100% efficient in their conversion of energy. They aren’t.
The Second Law of Thermodynamics will not be denied.
You overlooked the magnetic fields