In reality, only we on the earth observe stars twinkling and shining. The perception of stars twinkling is mainly because the earth has a lot of layers in the surrounding atmosphere with distinct air density and temperature. Due to this, the light that is reflected on the surface of the earth (from where we observe) from the star persistently bents as it passes over different mediums or density of air that surrounds the earth. The air around the earth that makes the layer is usually in a whirling mode which disturbs the light coming from a direction and, therefore, makes the star appear shining brightly and twinkling with a different frequency every time we observe it.
As we move away from the earth or out of its atmosphere, stars do not twinkle as there is no atmosphere or layer of air in space. The continuous bending of light makes us feel that stars twinkle.