Human gait can be measured using a change in the joint angles value of the lower limb joints during walking. Inverse kinematics (IK) of a human leg refers to calculating joint angle values from different leg positions during locomotion. This paper calculates a real-time IK for a 3-link kinematic leg using a musculoskeletal model in OpenSim. The model provides the analytical solution of IK, which is quick and accurate. But, the model-based approach is very much dependent on the morphology of the bipedal robot. The existing bipedal robots are mainly planned for walking on flat terrain and unconstrained environment. So, these limitations lead to the developing of a generalised polynomial equation for generating walking trajectories. The model-based approaches rely on the degree of similarity between the virtual human model and the actual human body, which does not fully describe the human body. Due to the difference in real and virtual models, the model-based approaches suffer during the optimisation process of the boundary conditions and the mass-inertial parameters, leading to an unstable numerical solution. The learning-based method using long short-term memory (LSTM) model for gait generation is proposed to overcome the limitation of model-based approaches.