He's right, that's exactly like an electric motor works, however, I think I know what your train of thought is and your "mag motor" would actually work if you reduced the stroke (stroke is the distance the pistons move up and down) of the engine to about 1/2" or less. Your mag motor wouldn't be nearly as efficient as a standard electric motor that turns in a smooth circle because your motor would have to use a lot of energy to power the reciprocating mass and friction of the piston(s), crankshaft, and bearings.
If you like working with magnets and motor/engine concepts, I recommend redirecting your thoughts toward Magnetic Levitation Motors (Google keywords: "mag lev" or "magnetic levitation" or "mag lev motor" or "mag lev train" , always using the quotes). When "Super Conductivity" is achieved at room temperature and above, I believe that magnetic levitation motors will be used almost exclusively in all electric motors including electric cars, trains, planes, appliances, and just about everything else you can imagine. Magnetic levitation is already powering commuter trains in Germany (conventional) and Japan (super conductive) and I believe that MAG LEV is the wave of the future with hundreds if not thousands of inventions needed in this area.
If you are really intent on converting a reciprocating engine into an electrical one, use a single piston .049 model airplane 2-stroke engine. It already has the correct stroke for a magnetic conversion. Add the propeller and a stand with batteries and it'll make a great conversation piece for your desk.