Execution is not punishment, because the convicted person's human experience ends.
Execution is not rehabiliatory, for the same obvious reason.
Execution is not preventative of the same person reoffending any more than imprisonment is.
Execution is not preventative of other people committing the same offense, because the act of execution is removed so completely in time and space from the crime and conviction. And it has to be so removed because of how completely wrong the justice system is kind of all the time.
Execution serves one purpose, and that is vengeance. The State should not be in the business of delivering vengeance to certain people.
Execution also doesn’t reduce offense rates because the severity of punishment doesn’t factor into decision making above “life ruining if convicted” it’s the certainty of being caught that reduces rates. The uk used to hang pickpockets in the town square and you’d get your pockets picked if you stood there watching.