Unfortunately, there is friction. Pretend you start with a fully charged battery, and are at a stop. You accelerate up to 60 miles per hour draining some of your battery charge. The problem is there is energy lost as friction between the tires and the road, in the drivetrain of the car, between the air and the car, between the electrons and the copper which heat the cable, etc. Accelerating from 0 to 60 miles per hour results and maybe 20% of the energy being lost as heat. When you slow down and use regenerative braking and recapture energy, it doesn't capture all of it. The entire system is Maybe 50 or 60% efficient, so you can never get back all the energy, meaning perpetual motion would be impossible.
Your only option is to take energy as an input somewhere, gas, battery charge, fuel cell, nuclear, etc. Right now most energy on the earth originated from our local fusion power source, the sun. Oil is from uncountable nuber of plankton and other organics that got their energy from the sun, die and sink to the bottom of the ocean and are slowly converted over a long time span. The sun constantly recharges the earth, so even the earth is not a perpetual motion machine. Even the sun is going to burn out eventually. Good thing for us we have a few billion years.