factors. I’m technically a chemist, not an astrophysicist, but off the top of my head I think there would be a lot of factors to consider with stars alone.
Also, keep in mind that temperature doesn’t always correlate to the amount of energy a molecule possesses. For example, it’s extremely cold high in the sky at altitudes where planes fly. Yet if you could see the molecules of air, you’d observe them bouncing around like crazy and with a lot of energy. The reason that it’s still cold up there is because there’s relatively few molecules at that altitude compared to at sea level.
Same principle would apply to space. There are even fewer molecules in space compared to Earth’s atmosphere, so the few molecules that are there can have enough energy to exist in the gaseous state without significantly raising the temperature.