My Xbox One S Is Having Problems And I Got It For Free And Want To Use It

Xbox one S - My games aren’t downloading all the way even after factory reset. After the factory reset the console started lagging bad and froze for an hour and I decided to stop waiting and unplugged it and waited then turned it back on. It kept doing it so i reset the console again and now every time i try to sign in the console spins on “signing you in” then freezes.