How can I prove that if two spaces $X$ and $Y$ are homotopy equivalent, then the corresponding spaces obtained by gluing a $k$-cell are also equivalent?
In detail, if $\varphi\!:\mathbb{S}^{k-1}\!\rightarrow\!X$ is a continuous map and $f\!:X\!\rightarrow\!Y$ is a homotopy equivalence, then $X\!\cup_\varphi\!\mathbb{B}^k$ and $Y\!\cup_{f\circ\varphi}\!\mathbb{B}^k$ are homotopy equivalent.
This is motivated by Shastri's Elements of Differential Topology, p.226, Corollary 8.3.4, Proof (i): .
My attempt: We extend $f$ to a map $\overline{f}\!:X_i\!\cup_\varphi\!\mathbb{B}^k \longrightarrow Y\!\cup_{f\circ\varphi}\!\mathbb{B}^k$ with the identity on $\mathbb{\mathring{B}}^k$. Then $\overline{f}$ is continuous: for every convergent sequence $\mathbb{\mathring{B}}^k\!\ni a_n\!\longrightarrow a\!\in\!\partial\mathbb{B}^k$ and $\varphi(a)\!=\!x\!\in\!X$, there holds $\mathbb{\mathring{B}}^k\!\ni \overline{f}(a_n)\!=\! a_n\!\longrightarrow a\!\in\!\partial\mathbb{B}^k$ and $f\!\circ\!\varphi(a)\!=\! \overline{f}(x)\!\in\!Y$, hence $\overline{f}(\lim_na_n)\!=\!\lim_n\overline{f}(a_n)$. Similarly, we extend the homotopy inverse $f'$ of $f$ to a map $\overline{f'}\!:Y_i\!\cup_{f\circ\varphi}\!\mathbb{B}^k \!\longrightarrow\! X\!\cup_{\varphi}\!\mathbb{B}^k$ with the identity on $\mathbb{\mathring{B}}^k$. Then $\overline{f'}$ is also continuous: for every convergent sequence $\mathbb{\mathring{B}}^k\!\ni a_n\!\longrightarrow a\!\in\!\partial\mathbb{B}^k$ and $f\!\circ\!\varphi(a)\!=\!y\!\in\!Y$, we have $\mathbb{\mathring{B}}^k\!\ni \overline{f'}(a_n)\!=\! a_n\!\longrightarrow a\!\in\!\partial\mathbb{B}^k$ and $\varphi(a) \overset{???}{=} \overline{f'}\!\circ\!f\!\circ\!\varphi(a) \!=\! \overline{f'}(y)\!\in\!X$, hence $\overline{f'}(\lim_na_n)\!=\!\lim_n\overline{f'}(a_n)$. Then we extend the homotopy $h\!:f'\!\circ\!f\simeq\mathrm{id}_X$ to a map $\overline{h}\!: (X_i\!\cup_\varphi\!\mathbb{B}^k)\!\times\!\mathbb{I} \longrightarrow X_i\!\cup_\varphi\!\mathbb{B}^k$ with the identity on $\mathbb{\mathring{B}}^k\!\times\!\mathbb{I}$. Similarly, we extend the homotopy $h'\!:f\!\circ\!f'\simeq\mathrm{id}_Y$.
Edit: From Milnor's Morse Theory, p. 21:
Question 1: In lemma 3.6, how do I define $l$? I don't think the following works: $\begin{array}{l} l(x)=x &;\; x\!\in\!X\\ l(tu)=2tu &;\; t\!\in\!{\textstyle[0,\frac{1}{2}]}, u\!\in\!S^{k-1}\\ l(tu)=\varphi_{2t-1}(u) & ;\; t\!\in\!{\textstyle[\frac{1}{2},1]}, u\!\in\!S^{k-1}. \end{array}$ Furthermore, what are then the homotopies between $kl$ and $lk$?
Edit: This $l$ turns out to be ok. Then we have $k\!\circ\!l\!=\!\! \begin{cases} \;\:x \mapsto x & ;\; x\!\in\!X\\ tu \mapsto 4tu & ;\; t\!\in\![0,\frac{1}{4}], u\!\in\!\mathbb{S}^{k-1}\\ tu \mapsto \varphi_{2-4t}(u) & ;\; t\!\in\![\frac{1}{4},\frac{1}{2}], u\!\in\!\mathbb{S}^{k-1}\\ tu \mapsto \varphi_{2t-1}(u) & ;\; t\!\in\![\frac{1}{2},1], u\!\in\!\mathbb{S}^{k-1} \end{cases}$ and $l\circ\!k\!=\!\! \begin{cases} \;\:x \mapsto x & ;\; x\!\in\!X\\ tu \mapsto 4tu & ;\; t\!\in\![0,\frac{1}{4}], u\!\in\!\mathbb{S}^{k-1}\\ tu \mapsto \varphi_{4t-1}(u) & ;\; t\!\in\![\frac{1}{4},\frac{1}{2}], u\!\in\!\mathbb{S}^{k-1}\\ tu \mapsto \varphi_{2-2t}(u) & ;\; t\!\in\![\frac{1}{2},1], u\!\in\!\mathbb{S}^{k-1} \end{cases}.$ The desired homotopies are then (where $s$ is the time parameter) $\begin{array}{ c @{\hspace{2pt}} l} \alpha\!\circ\!\beta\simeq \mathrm{id}_{X\cup_{\varphi_1}\mathbb{B}^k} & \;\;u\!\in\!\mathbb{S}^{k-1}\\ x & ;\; x\!\in\!X\\ (4\!-\!3s)tu & ;\; t\!\in\![0,\frac{1}{4}] \\[1pt] (1\!+\!s(t\!-\!1))\varphi_{4t(s-1)+2-s}(u) & ;\; t\!\in\![\frac{1}{4},\frac{1}{2}]\\[1pt] (1\!+\!s(t\!-\!1))\varphi_{2t(1-s)+2s-1}(u) & ;\; t\!\in\![\frac{1}{2},1] \end{array}$ and $\begin{array}{c @{\hspace{2pt}} l} \beta\circ\!\alpha\simeq \mathrm{id}_{X\cup_{\varphi_0}\mathbb{B}^k} & \;\;u\!\in\!\mathbb{S}^{k-1}\\ x & ;\; x\!\in\!X\\ (4\!-\!3s)tu & ;\; t\!\in\![0,\frac{1}{4}]\\[1pt] (1\!+\!s(t\!-\!1))\varphi_{(4t-1)(1-s)}(u) & ;\; t\!\in\![\frac{1}{4},\frac{1}{2}]\\[1pt] (1\!+\!s(t\!-\!1))\varphi_{2(1-t)(1-s)}(u) & ;\; t\!\in\![\frac{1}{2},1] \end{array}. $
Question 2: In lemma 3.7, how can I see that $G$ has a left inverse?