Macbook stuck at login screen

You need to backup the disk ASAP before your data is lost. Then replace the bad hard drive and I would reinstall macOS from scratch on the new drive. Last copy your data back to the drive. If you have a time machine backup you can restore that to the new hard drive in one step.

Give us some model info on your Mac and we can advise you more.