On an e-bike you would be losing significant portion of energy from propelling the bike, friction, air drag and heat loss. You might be able to put a small amount of energy back in from pedaling, going down hills or even braking, but certainly not enough to make it perpetual.
Perpetual motion machine are physically impossible based on our current understanding of physics. Many, many people have attempted to create them, but they all fail from the reaaons above.
With the bike, the battery (and pedaling) is the source of your net energy output. Losses from friction to the ground and air drag will be the most significant net consumers of the energy. It doesn’t matter how the rest of that energy is moved around within the system(s) of the bike.
Ultimately, what determines the distance you travel is the capacity of the battery and what external environmental factors affect the bike and by how much. Biking at 3m/s will have less air drag than 10m/s. Friction will be affected by the surfaces you go over, with something like mud taking more energy compared to something smooth like smooth concrete.