We know that the light gets refracted when it enter a medium low/high refractive index.
But why light is not refracted when it comes out from the vertex of a prism.
Light is refracted on the way in and on the way out. The refractive index varies with the wavelength of the light, red being refracted less than blue.
If the "in" and "out" faces of the prism were parallel then the difference in refraction effectively cancels out - look through a window and light directions are not changed. But in a triangular prism the "cancelling " doesn't happen. You can see this if you draw a ray diagram, consult an elementary level book on optics, or just look at the above diagram.
Light gets refracted at ANY interface between two transparent mediums, following the Snell-Descartes law:
That's it. The equation also accounts for the fact that there is no change of direction at normal incidence ($i_1=0 \implies i_2=0$).
Most prisms, certainly one you can hold in your hand, are large with respect to the wavelength of light, so diffraction is a insignificant effect. Prisms produce the color spectrum from sunlight, for example, due to refraction, not due to diffraction.