Purgatory is a primarily Catholic doctrine (but not exclusively) involving a possibly temporary in-between place that is neither heaven or hell.
Wikipedia definition of Purgatory:
Purgatory is, according to Catholic teaching, the state or place of purification or temporary punishment by which those who die in a state of grace are believed to be made ready for the Beatific Vision in Heaven. Only one who dies in a state of grace can be in Purgatory, and therefore no one who is in Purgatory will remain there forever or go to Hell.