# Homotopic attaching maps give Homotopy Equivalent spaces

I want to prove that if $f,g : S^{n-1} \to X$ are homotopic maps then the resulting spaces $X \cup_f D^n$ and $X \cup_g D^n$ are homotopy equivalent. I know this question has been asked before:

Homotopy equivalence of two different gluings of $B^n$ and an arbitrary space $X$

The work I have done so far is to consider the space

$Y = X \cup_H (D^n \times I)$ where $H$ is a homotopy from $f$ to $g$, and then

$X \cup_f D^n \simeq X \cup_H (D^n \times \{0\})$ and $X \cup_g D^n \simeq X \cup_H (D^n \times \{1\})$, so all I need to do is to show that $X \cup_H (D^n \times \{0\})$ is a homotopy retract of $X \cup_H (D^n \times I)$.

But I can't think of any continuous maps which are homotopic to the identity, maybe there are obvious ones though, or maybe my approach is totally wrong, but thanks for any help!