Why are spectrum lines useful and classify stars

Spectral lines identify the elements in the star's surface and those near the edge of the interior. Also the spectral absorption lines/bands can help identify the molecules in the gaseous mixture and this determines the temperature of the star and help to classify each one as to blue, red, black, etc.