Purgatory is a final purification to achieve the holiness necessary to enter heaven—this is entirely different from the punishment of hell. The Catechism of the Catholic Church explains:
To understand this doctrine and practice of the Church, it is necessary to understand that sin has a double consequence. Grave sin deprives us of communion with God and therefore makes us incapable of eternal life, the privation of which is called the "eternal punishment" of sin. On the other hand every sin, even venial, entails an unhealthy attachment to creatures, which must be purified either here on earth, or after death in the state called Purgatory. This purification frees one from what is called the "temporal punishment" of sin. These two punishments must not be conceived of as a kind of vengeance inflicted by God from without, but as following from the very nature of sin. A conversion which proceeds from a fervent charity can attain the complete purification of the sinner in such a way that no punishment would remain. (CCC 1472)
Unlike the damned, those in the state of purgatory have the joy of knowing that, upon purification, they will enter eternal life in heaven.