I’ve got into an issue while posing a character whenever I move the foot of my character upward the knees automatically move inwards to each other in the center
That looks like a rigify rig, even if it’s not, you have the IK foot controller selected. Generally IK limbs have pole targets for the knee/elbows to control the direction of the knees/elbows. I’m not seeing it in your screenshot, but look for it. Probably called Knee…something.
I bet I know what happened here. That totally looks like Rigify, and hence a metarig used for bone placement.
When you placed the leg bones, you did them in a straight line from side on. That in turn messed up the default pole target and you get the result you have.
Instead you need a little bend in the knee (usually forward for a human) which lets Rigify know where to place the pole target.