We kill people who killed someone to teach them that killing is wrong because they shouldn't have killed them in the first place because it would be better than allowing them to stay in prison for the rest of their life because they will be kill due to a life sentence sometimes killing the killer is not allowed though
Translation of the above sentence with punctuation:
We give the death penalty to some murderers because a life sentence would just be a waste of money for the prison. There's no reason for somebody who committed an act worthy of a death sentence to be alive.
The real question here is what is a "worthy" enough of a crime to be announced as a death sentence.