As the comment from Lorago suggests, this exercise is asking you to prove something that is false, as the counterexample of $\mathbb Q\subseteq \mathbb R$ shows.
Based on the hint, however, it is highly likely that $A$ is meant to be open. In fact, the second coordinate of the map described in the hint will be finite everywhere if and only if $A$ is open, so this is the only context in which the hint makes sense.
Supposing that $A$ is assumed to be open, the claim is indeed true. In this case, (assuming with no loss of generality that $A\neq X$, as otherwise the proof is trivial) the map $g$ from the hint is well-defined, injective, and continuous (since each coordinate function is continuous), if $X\times \mathbb R$ is given the product topology.
Also as discussed in the comments, $g$ does not map surjectively onto $X\times \mathbb R$, but this is no matter, as it still maps surjectively onto its image $g(A)$ (as every map does).
Moreover, $g^{-1}\colon g(A)\to A$ is given by projection onto the first coordinate, which is continuous. Therefore $g$ is a homeomorphism onto its image.
It remains to show that $g(A)$ has a complete metric. To see this, give $X\times \mathbb R$ the metric $d((x_1,r_1),(x_2,r_2))=\sup(d(x_1,x_2),|r_1-r_2|)$. It is straightforward to verify that $X\times \mathbb R$ is complete with this metric (just use completeness in each coordinate), and that this metric induces the product topology.
Finally, observe that if $(x_n,r_n)\in g(A)$, and $(x_n,r_n)\to (x,r)$, then since $x_n\in A$ and $r_n=\frac{1}{d(x_n,A^c)}\to r\neq \infty$, we have $d(x_n,A^c)\not\to 0$, so $d(x,A^c)\neq 0$, whereby $x\notin A^c$ (since $A^c$ is closed), so that $x\in A$.
We also have $r=\frac{1}{d(x,A^c)}$ by continuity of the distance function, so that $(x,r)=g(x)\in g(A)$. Therefore $g(A)$ is a closed subset of a complete metric space, and is thus itself complete under this metric.