Vit
B12 in moderate dose and for certain period is safe to take.But if u have some mental problems, obsessive thoughts tgen u have to treat it to proper health professional. Consult psychologist online or offline and take help.
Ur problems needs to be evaluated to find actual causes behind them.
Emotional disturbance, long lasting mental grief, harassment, physical assault, childhood abuse, career problems, financial problems etc may be the causes ,but there are so many causes there.
Feel free to contact if needed.