When ${\bf A}=\nabla f$ in some region $\Omega\subset{\mathbb R}^3$ then for any curve $\gamma\subset\Omega$ with initial point ${\bf p}$ and endpoint ${\bf q}$ one has
$$f({\bf q})-f({\bf p})=\int_\gamma {\bf A}\cdot d{\bf x}\ .\tag{1}$$
This is the $3$-dimensional version of the familiar formula
$$f(q)-f(p)=\int_p^q f'(t)\>dt$$
from elementary calculus.
Now in your setting we are given a vector field ${\bf A}$ in some region $\Omega\subset{\mathbb R}^3$, and we are assured that ${\bf A}=\nabla f$ for some $f:\>\Omega\to{\mathbb R}$. This $f$ is only determined up to an additive constant anyway; therefore we may fix $f({\bf p}_0)$ for some point ${\bf p}_0\in\Omega$ arbitrarily. But then $(1)$ says that for any point ${\bf q}\in\Omega$ one has
$$f({\bf q})=f({\bf p}_0)+\int_{{\bf p}_0}^{\bf q}{\bf A}\cdot d{\bf x}\ ,$$
where the right hand side can be computed along any curve $\gamma$ connecting ${\bf p}_0$ with ${\bf q}$. When the segment $[{\bf p}_0,{\bf q}]$ is contained in $\Omega$ then one may take for $\gamma$ this segment, having the parametrization
$$\gamma:\quad t\mapsto {\bf p}_0+t({\bf q}-{\bf p}_0)\qquad(0\leq t\leq1)\ .$$