You were already told at the very beginning - work is not a state function.
In very specific case of gravitational fields, if everything else is neglected, potential energy of the body depends only on its state - that is, distance from the mass center. Hence potential energy is a state function in this case. As changes in the potential energy will be identical to the work done, work will also depend only on the state (position), so it will behave like a state function. But that's only in a very specfic case, in general work is NOT a function of state, as amount of work required to move body from one place to another depends on the path.