Going through with surgery on your knee is very scary. Perhaps you were told by a doctor that only with a total knee replacement would you be able to get some of your mobility back. Perhaps you had a bad injury when you used to play sports, or you recently came down with some knee condition. Now you have to make sure that you are putting a priority on being able to walk and run in the remaining years of your life. You have to think about the future that you want and how you are going to go ahead and make that future a reality.
Talk to your doctor and make sure you are fully aware of how this procedure is going to go. Have an idea in your mind about what the recovery will be like. Only when you are mentally prepared will you be able to get through this process with a positive mindset. Then you will be able to get back to your life, and continue the rehab that is necessary so that your new knee can be functioning in the right way. Keep in mind that such rehab is not easy and is going to test you.
Think of this rehab as a way for you to learn how to walk again. You are going through such an ordeal, but you have to get all the movement and flexibility in your knee back again. That is the only way you will be able to gain full use of your legs in the way that you want. Then you will be able to go out for walks or even run for some time and not have any pain or soreness. That may take you some months to achieve, but that is the endgame you are working towards achieving.