How do wars end? Lots of different ways. One of the most common is also the simplest: the losing side surrenders and sues for terms. Needless to say, these terms are often harsh.
Wars can also end via negotiated settlements, usually mediated by a third party. In these cases the losing side often avoids the harsh terms of formal surrender but nonetheless is forced to accept a small fraction of what it wants.
Surrender and negotiation have one thing in common: both sides, but especially the losing side, have to stop fighting.
The Arab-Israeli War¹ has been ongoing for 80 years or so. The Arab side that started the war has lost. They've lost over and over and over, and they have no chance of changing that. They are outmatched in conventional terms, and even if, somehow, they were able to turn this around, Israel has nuclear weapons available in the last extremity. Put simply, the Arab side literally has zero chance of ever winning.
But they refuse to surrender. So the war continues, and Israel's defense becomes steadily more brutal in an effort to finally force surrender. None of this is necessarily fair. It is, however, the way the world works and always has.
The Arab-Israeli War will end when the Arab side surrenders. So far, only Egypt and Jordan have effectively done this, and they've had peaceful relations with Israel ever since.
The same thing will happen with any other organization or state that recognizes reality and surrenders. The terms of this surrender have gotten worse over the years as the fighting has continued, but that's to be expected. They'll get worse still as long as the fight goes on.
Like it or not, this is the only endgame. Short of Carthage-like annihilation, the Arab side has lost as thoroughly as any side has ever lost in history. They need to surrender and then rely on the US and Europe to help them avoid the harshest possible terms from Israel. It's the only way this ever ends.
¹This should be "Arab plus Iranian," but there's no good word for that. Just assume that Iran is included in all references.