God is a loving God, but He is also a Just God.
By commiting a mortal sin, we are choosing to exclude ourselves from being with God in heaven, so I agree with you there and the
CCC #1033 “This state of definitive self-exclusion from communion with God and the blessed is called “hell.””
But the CCC then goes on to say in 1034 " Jesus often speaks of “Gehenna” of “
the unquenchable fire” reserved for those who to the end of their lives refuse to believe and be converted, where both soul
and body can be lost.
612 Jesus solemnly proclaims that he “will send his angels, and they will gather . . . all evil doers, and throw them into the furnace of fire,”(Bold and Italics are mine + unquenchable = unending=eternity. Body … unquenchable fire … suffering)
In #1035 it says: “The teaching of the Church affirms the existence of hell and its eternity. … The chief
punishment of hell is eternal separation from God” (Bold emphasis is mine).
So yes, while punishment for sin is not specifically mentioned in the CCC, there must be punishment as that would be just. God is not only merciful but He is also a Just God. The opposite is the reward of the just - an eternity in heaven with God.
So
punishment is the counterpart to reward.
What are souls being punished for? For the mortal and unrepented sins they committed in life.
Contra Gentiles Book 3 Providence Part II Chapter 140 That a Man’s Acts Are Punished Or Rewarded By God.
EWTN - Hell down the bottom of which is a *[Note: … Thus, after the general resurrection the bodies of the damned, being bodies not spirits, must be in “some place,” in which they will receive the
punishment of fire.] (Bold and Italics are mine). Comes from a
General Audience of Wednesday, 28 July 1999, St Pope John Paul II.
The Hell There Is! search using the term “punishment”.
Eternal Punishment by Rev. William G. Most
Catholic Answers Encyclopedia Hell Treatment of the doctrine of hell 11/19/2018 scroll down to the sections starting with POENA DAMNI.
I believe that the punishments are a consequence of the mortal sins we commit. That God is not one sided - all mercy, but is also a Just God. That these punishments are from within and
without. That there are different degrees of punishment/torment/suffering as corresponding to the sins committed. The same as I believe the merits or crown of glory a soul has in heaven is awarded/rewarded by God according to the good the soul did in life.