Your machine uses pressurized air to run it. Energy had to be put in to pressurize that air. Trying to charge a battery from the magnets motion will also take energy from the system which would require more pressure to run it at the same speed. You can do what you want as long as you realize...
Whats the best way to determine the energy produced by a permanent magnet cogging (completing) a magnetic circuit. I suspect it would be the same for uncogging (removing the magnet from the circuit). Envision a ferrite ring with a gap essentally the same size as the permanent magnet to close...