Beside the fact that it isn't practical, they would need to amend their constitution before they could hold an election during wartime. This is all also ignoring the question begging that the original poster was engaged in with the assumption that holding an election would end the war.
Theoretically, if you exclude the occupied parts from voting, you'd ensure no Yanukovich-like candidate winning.
On the other hand, Trump can always move the goalpost ("Election not held in eastern Oblasts == Sham elections") or even reinforce the view that the eastern oblasts are de facto not part of the Ukrainian state anymore.
And on the knowledge that Russia will certainly conduct strikes on polling stations.
Also Zelensky's popularity has shot up since Trump started aligning with Russia. And the next most likely president is probably even more hawkish towards Russia.
The Russian army can decide to leave and go to their side of the border at any time. It's more complicated than that (war crimes, reparations, all the people that have been abducted) but I still wonder why this is not being discussed at more often - it is totally clear who is the agressor here.