Let provide a real historical example from India.You can agree with everything you just said while still not believing the death penalty as a state-sanctioned punishment for breaking certain laws is ethical. To say "person x doesn't deserve to live" or "the world would be better if a person who did x no longer lived in it" does not necessarily conflict with the statement "I believe the state should not have the right to put people to death" or "the death penalty as a criminal punishment is not justified".
Around 1995, the Indian police arrested a terrorist leader for executing several terrorist attacks. He went to trial, and instead of death penalty, he got life in prison. Then, a few years later, the terror group whose leader he was hijacked an India plane and landed it in Afghanistan where, with the help of the Taliban govt., forced the Indian govt. to release the terrorist leader in exchange for the 200 passengers on the plane. Then this terrorist leader took refuge in Pakistan and planned and executed the Mumbai terrorist attack that killed 400 people.
In my view, some people are too dangerous to be given life sentences and a country should consider whether it has the ability to contain such people from doing future mayhem before deciding such things.
Indian Airlines Flight 814 - Wikipedia