A (not so) quick reminder: the first "law" of thermodynamics states that energy can neither be created nor destroyed, only converted between forms. This is something of an assumption (it is unprovable), but it holds very well for most terrestrial situations thus far, plus it underpinned the industrial revolution and the development of classical physics itself.
In theory, that could mean a generator driving a motor could work indefinitely (once moving), because the energy just loops around between the two -
assuming no "losses" whatsoever (friction, and so on). In theory, this motion could be sustained
in perpetuum.
Alternatively, you could draw energy from the (comparatively, apparently, but not actually) "infinite" supply of the surroundings and appear to defy the first law, or you could try to recover all the energy that was expended - which is where the second law comes in.
Loosely, the second law of thermodynamics states that all processes proceed "downhill" according to the concept of entropy - you cannot climb back up that hill without pushing something else down it, and you cannot do useful work without (something) sliding down the hill also. This is an empirical (observed) property, that has also stood the test of time on Earth (but is also unprovable).
Entropy is related to the efficiency of processes, which is defined as the "useful" work obtained as a ratio of the work (energy) put in. For our motor-generator loop, we are implying 100% efficiency of both items, which in turn implies constant entropy (which further implies no useful work can be produced, in fact, but that's much harder to explain in electro-mechanical terms).
Entropy is also said to be a measure of "disorder"; processes therefore proceed in the direction of ordered to disordered ("downhill") - to make one thing more "ordered", you have to make something else even more "disordered", resulting in a net gain towards disorder. Another way to look at it is to say that "disordered" energy is "degraded", and therefore "less useful" than a more "ordered", or "higher grade" of energy.
More on the second law of thermodynamics here.
To maintain a constant speed, the motor has to overcome the combined friction of the rolling resistance and air resistance - this is our useful work out. That energy expenditure needs to be replaced by some input in order not to defy the first law of thermodynamics: namely it is not possible for the car to maintain a constant speed against an energy drain (friction), without an equivalent energy source. Note that "drain" and "source" here imply conversions, not destruction and creation, e.g. "friction" ultimately converts "kinetic energy" (ordered motion) into "heat" (disordered motion) via various mechanisms.
Suppose that we use a wheel-driven generator to "supply" the missing energy; unfortunately, it can only draw from any surplus energy left over from keeping the car at a constant speed (otherwise the car would slow down). So that means your motor has to supply more energy than is required simply to maintain a constant speed.
If the motor and generator are 100% efficient, then that's no problem, and all of the surplus energy sent to the motor is re-recovered by the generator. But you still have an energy deficit equal to that required to overcome the car's other sources of friction - first law. So we've solved nothing, and the generator cannot supply the replacement for the expenditure in the first place. Add to that the efficiency is never 100%, and you see that the generator can only ever result in more wasted energy, effectively becoming an additional friction - second law.
If there were no losses whatsoever (no friction at all), then the motor-generator loop would appear to work. But in fact, in such a situation, the car would continue at a constant speed all on its own (Newton's first law of motion; the law of inertia). So the generator is even less necessary in that case.
In the real world, the car would go further at a constant speed, given a fixed supply of energy (i.e. a battery), without the generator engaged. If you need to slow down, by all means engage the generator instead of the brakes to charge the battery - this is regenerative braking. It's still a net loss exercise due to entropy (efficiency less than 100%), meaning the recovered energy will not get you back up to your original speed. This is much the same as a ball never bounces back up to the height it was released from, and each subsequent bounce is lower still.
As mentioned, this is firmly in the realm of perpetual motion. (Just don't mention "dark matter / dark energy"
).