We had this example in class the other day, and the professor didn't not walk through how he obtained it.
Compute $\int_C \vec f \cdot d\vec r = \langle 4x^3y^2 - 2xy^3, 2x^4y - 3x^2y^2 + 4y^3\rangle$
The answer was written as $F(x,y) = x^4y^2 - x^2y^3 + y^4$
Maybe someone can confirm I did it the right way, here's my work:
$$P_y = 8x^3y - 6xy^2$$
$$Q_x = 8x^3y - 6xy^2$$
So it might be the gradient field, since they agree.
$$F_x = 4x^3y^2 - 2xy^3$$
$$\int F_x \ dx = x^4y^2 - x^2y^3 + g'(y)$$
$$F_y = 2x^4y - 3x^2y^2 + 4y^3$$
$$\int F_y \ dy = x^4y^2 - x^2y^3 + y^4$$
So $g'(y)$ is supposed to be $y^4$ since I guess $\int F_x \,dx$ and $\int F_y \,dy$ are supposed to be equal?
Then $F(x,y) = x^4y^2 - x^2y^3 + y^4$
A couple of things. First, the answer is not $F(x,y)$; this is the gradient field. Presumably the answer is really $F(a_2,b_2)-f(a_1,b_1)$ where these are the endpoints of $C$. Now, as to your method, it's almost OK. It's more usual to do what you did by integrating $F_x$, then differentiate with respect to $y$ and compare that with $F_y$. The way you did things, the integral of $F_y$ should also have a term $+h(x)$, and you must do more work to convince yourself of the correct answer. (And, why did you call the function you got $g'(y)$ instead of $g(y)$?).
So: $\int F_x\,dx = x^4y^2 - x^2y^3 + g(y)$; then the derivative with respect to $y$ of this function is $2x^4y - 3x^2y^2 + g'(y)$, which must equal $2x^4y - 3x^2y^2 + 4y^3$, so that $g'(y) = 4y^3$ and therefore $g(y) = y^4+C$. Thus $F(x,y) = x^4y^2 - x^2y^3 + y^4 + C$.