Both Sun and a Star have Helium and Hydrogen but the sun light is yellow or orange and the star light is white.
Why?
Actually, this is a surprisingly good question - the answer is we don't know. Wait wait wait you're saying; of course we know! We can see the sun is yellow! Every child draws it as a yellow ball!
The problem is, the sun is very much white. For whatever reason, we all seem to perceive or think the sun is yellow even though it's not. In fact, there's a special name for this: the yellow sun paradox. This is common, and most people will conclude that the scattering of light from the blue sky causes it. But even this isn't correct. Many, many studies have shown that Rayleigh scattering (what happens when sunlight goes through the atmosphere) is not strong enough to affect the sun’s white light.
In all likelihood, the matter is mostly subjective and cultural. The sun’s light shifts as it moves lower in the sky and the light has a longer refractive path, turning slowly red. This is generally the only time we can directly see the sun without pain or damage. It is reasonable to backtrack and assume that when the sun is at its zenith, it must be yellow, despite that fact that scientifically… it is not.