Hi and Welcome!
I’m sorry about the ankle sprain. Is it on the same side as the TKR? What exercises are you doing for it?
The back of my knee is very painful when I try to bend my knee back.
You may be overdoing the bending. What exercises are you doing for the knee?
Regaining our ROM does
not require forceful bending or painful exercises.
Regaining our ROM is more about Time than repetitions of a list of exercises.
Time to recover.
Time for pain and swelling to settle.
Time to heal.
Our range of motion is right there all along just waiting for that to happen so it can show itself.
In the general run of things, it doesn't need to be fought for, worked hard for or worried about. It will happen.
Normal activity is the key to success.