Let $q:X\coprod Y \rightarrow X\coprod Y\backslash \sim$ be the quotient map, where $X\coprod Y\backslash \sim$ is the quotient space and $f:A\subseteq Y \rightarrow X$ is the attaching map. Note $\sim$ is the equivalence relation generated by $a\sim f(a)$ for all $a\in A$, where $A$ is a closed subspace of $Y$.
How do I show that $q|_X$ is injective?
$X\coprod Y/\backslash\sim$ $=X-A\coprod Y-f(A)\coprod\{(a,f(a)),a\in A\}$,
$q(x)=x$ if $x\in X-A$, $q(x)=(x,f(x))$ if $x\in A$. Suppose that $q(x)=q(y)$. If $x,y\in X-A, q(x)=x=q(y)=y$. If $x\in X-A, y\in A q(x)$ and $q(y)$ are in disjoint subsets impossible. If $x,y\in A, (x,f(x))=(y,f(y))$ implies that $x=y$.