explain how gravitational pull of the sun and inertia keep the earth in orbit around the sun?

The earth tries to maintain its inertia as it moves perpendicular to the direction of the sun, but the sun's gravitational attraction force keeps changing the direction of earth's motion, forcing the earth to move in a circular path.