How can I repair my Mac so Time Machine backup will work?
I would suggest backing up your files using CCC (Carbon Copy Clone), which makes a bootable duplicate of your drive.

You can get the 30 day trial for CCC here, or here for the a paid version (I always suggest paying the people who made the apps though).

Also, I suggest reinstalling macOS from the recovery partition (reboot using cmd R).

Personally, using the time machine rarely works for me.