He’s in a tough spot now. Since he made a huge deal about supporting Ukraine he can’t just say, ‘I’m out’ and leave. If he did, people would say he failed and that would damage his reputation.

His political opponents in the US would use it against him. And Russia would celebrate. Putin would argue they’ve proven they can beat the U.S. He often says they’re not fighting Ukraine but America.
Many Americans would feel angry and betrayed if he gave up and tried to be friendly with Russia while the war is still going.
So why does he keep trying? Maybe it’s because the war needs to end the right way, with Ukraine agreeing. If that happens, the U.S. could lift the sanctions on Russia. Politicians could then tell voters they found a smart solution.
That could open the door to future business deals with Russia, which might help him or his family later on.
Also, Europe won’t remove its own sanctions until there’s peace. And the U.S. needs to stay in step with its European partners on big world issues.
So he’s kind of stuck. He has strong reasons to keep going. When he says he might quit, it’s likely just talk.