Let $X$ and $Y$ be non empty topological spaces. Consider $X\coprod Y = (X\cup 0) \cup (Y\times 1)$. We define a topology on $X\coprod Y$ by declaring $U$ is open in $X\coprod Y$ if and only if $\iota_{1}^{-1}(U)$ is open in $X$ and $\iota_2^{-1}(U)$ is open in $Y$. Here, $\iota_1:X\rightarrow X\coprod Y$ is given by $\iota_1(x)=(x,0)$ and $\iota_2$ is defined similarly. In particular, $\iota_2(y)=(y,1)$.
Now let $A\subseteq X$ be closed. Suppose $f:A\rightarrow Y$ is continuous. Then we may consider the adjunction space $X\cup_f Y= (X\coprod Y)/((a,0)\sim (f(a),1))$ which identifies $a$ with $f(a)$ for all $a\in A$.
We may abuse notation and write $(a,0)$ as $a$ and $(f(a),1)$ as $f(a)$.
Problem:
Let $X$ be space space and $A$ non empty closed subset of $X$. Let $f:A\rightarrow Y$ be continuous. Assume $C\subseteq X\coprod Y$ is such that $\iota_1^{-1}(C)$ is closed in $X$. Then
$q(C)$ is closed in $X\cup_f Y$ if and only if $\iota_{2}^{-1}(C)\cup f(\iota_{1}^{-1}(C)\cap A)$ is closed in $Y$.
My attempt: If $q(C)$ is closed in $X\cup_f Y$ then $q^{-1}q(C)$ is closed in $X\coprod Y$ . In particular, $\iota_{2}^{-1}q^{-1}q(C)$ is closed in $Y$. As $\iota_{2}^{-1}q^{-1}q(C)= \iota_{2}^{-1}(C)\cup f(\iota_{1}^{-1}(C\cap A))$, the result then follows.
Is this proof correct? Why is the assumption $\iota_{1}^{-1}(C)$ closed important?
Note that $q$ is the canonical projection map
Your proof of the "only if" is correct, now you have to prove the other direction. By going backwards on your proof, we already know that if $i_2^{-1}(C) \cup f(i_1^{-1}(C \cap A))$ is closed, then so is $i_2^{-1}q^{-1}q(C)$, we are now left to show that $i_1^{-1}q^{-1}q(C)$ is closed to conclude that $q^{-1}q(C)$ is closed in $X \sqcup Y$, which will imply that $q(C)$ is closed. Now since
$$i_1^{-1}q^{-1}q(C) = i_1^{-1}(C) \cup f^{-1}(i_2^{-1}(C) \cup f(i_1^{-1}(C \cap A)) $$
then by the hypothesis that $i_1^{-1}(C)$ is closed, that $f$ is continuous and that $i_2^{-1}(C) \cup f(i_1^{-1}(C \cap A)$ is closed, we conclude that $i_1^{-1}q^{-1}q(C)$ is closed.