The black line you’re talking about could be a cavity or just a stain. It is advisable to get cavities filled as soon as you see any sign. On the surface of the teeth, the enamel is the hardest so a visible thin line or spot could easily be a deep cavity. If left untreated, you may need a root canal treatment. In case it is just a stain, you don’t need any treatment.
Next Steps
A dentist will be able to tell you whether it is a stain or a cavity and may even make an X-ray to confirm.