Thanks for posting your query.
You might having stretched or torn ligament or meniscal injury
Due to this, your knee becomes unstable and painful walking .
If your knee locks in position when you are moving, it can be due to damaged cartilage
I suggest you to consult an orthopaedician nearby for a detailed examination of knee. You may get the X-ray/MRI
of the area affected under his/her guidance to determine extent of damage and further treatment.
Wishing you good health
Dr Saurabh Gupta