$\require{AMScd}$
There is a retraction of $D^n\times I\twoheadrightarrow D^n×\{0\}\cup S^{n-1}×I$ defined via
$$r(x,t)=\begin{cases}
\left(\frac{2x}{2-t},\ 0\right) &\text{, if }t\le2(1-||x||) \\
\left(\frac x{||x||},2-\frac{2-t}{||x||}\right)&\text{, if }t\ge2(1-||x||)
\end{cases}$$ It is easy to prove that this map is well-defined and continuous and a retraction. Then $$d:D^n×I×I\to D^n×I\\ d(x,t,s)=sr(x,t)+(1-s)(x,t)$$
is a homotopy between the identity and $r$, so $r$ is a deformation retraction.
But then $(D^n×I)\cup_H X$ deformation retracts onto
$(D^n×\{0\}\cup S^{n-1}×I)\cup_H X=(D^n×\{0\})\cup_f X$
Note that a pushout square ($A,X$, and $B$ are arbitrary spaces)
\begin{CD}
A @>f>> B\\@ViVV @VV\tilde iV\\ X @>>\tilde f> X\cup_f B
\end{CD}
gives rise to a pushout square
\begin{CD}
A\times I @>f>> B \times I\\@ViVV @VV\tilde iV\\ X\times I @>>\tilde f> (X\cup_f B)\times I
\end{CD}
because the quotient map $q:X\sqcup B\to X\cup_f B$ induces a quotient map
$q\times 1:X\times I\sqcup B\times I\to(X\cup_f B)\times I$.
This means that a pair of homotopies $F_t:X→Y$, $G_t:B→Y$, such that $F_ti=G_t f$ for all $t\in I$, induces a homotopy
$H_t:X∪_f B→Y$
That's the reason why a deformation retraction on $D^n×I$ induces a deformation retraction on the pushout $(D^n×I)\cup_F X$
There is more general result: If $(X,A)$ is cofibered, then $X×I$ deformation retracts to $X×\{0\}\cup A×I$, so if $X$ is glued via two homotopic maps $f$ and $g$ to a space $B$, then $X\cup_f B$ and $X\cup_g B$ are homotopy equivalent.
Let
$M$
be a closed connected
$n$
manifold then $H_i(M;\mathbb Z)=0$ for each $i>n$. If in addition $M$ is orientable then $H_n(M;\mathbb Z)\cong \mathbb Z$.
For a proof see Hatcher Theorem 3.26.
Apply this to $M=S^1$ which is a closed connected orientable $1$-manifold.
Best Answer
Whenever you have a subspace $A\subseteq X$ and a deformation retraction $H:X\times [0,1]\to X$ onto $A$ (such that $H(x,0)=x$ and $H(x,1)\in A$ for all $x\in X$ and $H(a,1)=a$ for all $a\in A$), you get a homotopy equivalence as follows. Let $f:X\to A$ be given by $f(x)=H(x,1)$ and $g:A\to X$ be the inclusion map. Then $f\circ g=Id_A$, and $H$ is a homotopy from $Id_X$ to $g\circ f$.