Physics doesn't quite work that way. Nobody's managed to build a "perpetual motion" machine that doesn't require some power to keep it moving.
If you have an electric car, some of your electric power is lost to heat in the motor's brushes and bearings, in the car's driveline and all of its bearings, the friction of the tires, aerodynamic drag, etc. Energy is lost just in the process of accelerating and maintaining speed.
On the flip side, if you then put a generator on the non-drive wheels, it won't be 100% efficient, either. You'll recover "some" energy, but still lose more to friction and heat.
But, while it can't be COMPLETELY done, if you look at a modern electric/hybrid like a Prius, they DO recover battery power under deceleration by effectively reversing the electric motor and using it as a generator. Google "regenerative braking" to learn more.