So penance doesn’t have anything to do with temporal punishment?
Not really, no. What you want to do, in order to reduce your temporal punishment in Purgatory, is to seek Indulgences. There are several good ones, including reading the Scriptures for 15 minutes, praying five decades of the Rosary, or participating in Catechism classes.
To receive the Indulgence for these actions, go to Confession within 8 days (before or after, doesn’t matter), receive Holy Communion on the same day or as soon as possible, pray an Our Father and a Hail Mary for the Pope’s intentions, and of course, intend to receive an Indulgence at the time that you do the action, as well as completing the action.
You can receive one Plenary Indulgence (the remission of all temporal punishment) per day, as long as you fully intend to repent of all of your sins, and do everything possible to avoid committing them again. (Realistically, you will probably sin again - but the intention to avoid sin is what matters, here, along with doing whatever you can to avoid any kind of temptation.)