Can't see any chance in recharging it as you're riding it. No charger can charge faster than the battery can output, so you'll still deplete the battery. Plus I'd say the battery wouldn't last very long either.
To directly power the motor, skipping the battery, your bike would need a generator capable of around 50 amps output to sustain a steady 25-30amp supply (running it around 50% of available rpm)....These are not small and not light, and use a lot of fuel.
Its more something like this.... Its a good two man carry. Even if you had a Bafang M620, you wouldn't want to lump this weight around with you...
If my math is right you'd need like 48v x 20amps so about 1000watts of power delivered to the bike to run it well. Even with losses you could say a ~2000watt generator would run it....but given the engineering required to have a 120v AC generator make consistent smooth 54v DC power under a wide variety of loads that vary quickly and often, I think it's a tough hill to climb (pun intended).
Charging a spare battery while riding is more practical but I'd go with a trailer not your back rack unless you want noise, fumes and vibrations right behind you while riding.