Exercise 1.1.18 in Hatcher's Algebraic Topology Background
I am currently trying to solve exercise 1.1.18 in Hatcher's Algebraic Topology. The part of the exercise I am interested in is the following:

Using the technique in the proof of Proposition 1.14, show that if a space $X$ is obtained from a path-connected subspace $A$ by attaching an n-cell $e^n$ with $n ≥ 2$, then the inclusion $A \hookrightarrow X$ induces a surjection on $\pi_1$ .

I know that $i:A \hookrightarrow X$ induces a homomorphism $i_*:\pi_1(A)\rightarrow \pi_1(X)$, so I only need to show this is a surjection. I think I understand the idea of the proof, which is to show that every loop $f\in \pi_1(X)$ is homotopic to a loop which is contained entirely in $A$. Hatcher's suggestion is to follow the proof $\pi_1(S^n)=0$ for $n\geq 2$, meaning that we should be able to push the sections of $f$ which are in the attached $n$-cell $e^n$ out. This is causing me a bit of trouble.
Attempt
Since $X$ is defined to be the result of attaching an $n$-cell to $A$ via some attaching map $\varphi:\partial D^n\rightarrow X$, it has the form $X=A \amalg e^n/\sim$, where $x\sim \varphi(x)$ for all $x \in \partial D^n$. Note first that since $A$ and $e^n$ are path connected, the adjunction space $X=A\cup_\varphi e^n$ is path connected. As such, our choice of base point does not affect the structure of $\pi_1(X)$, so let $x_0 \in A$ be the base point of $\pi_1(X)$ we are working over. Let $f \in \pi_1(X,x_0)$. Let $E=\text{Int}(e^n)$ and consider $f^{-1}(E)$. This is an open subset of $(0,1)$, so it is the union of a possibly infinite collection of subsets of $(0,1)$ of the form $(a_i,b_i)$. Let $f_i$ denote the restriction of $f$ to $(a_i,b_i)$. Note that $f_i$ lies in $e^n$ and, in particular, $f(a_i)$ and $f(b_i)$ lie on the boundary of $e^n$, so they are elements of $A$. For $n\geq 2$ we can homotopy $f_i$ to the path $g_i$ from $f(a_i)$ to $f(b_i)$ that goes along the boundary of $e^n$, which is homeomorphic to $S^{n-1}$, so it is path connected for $n\geq 2$. Since $e^n$ is homeomorphic to $D^n$, where $n\geq 2$, it is simply connected so $f_i$ and $g_i$ are homotopic. Repeating this process for all $f_i$, we obtain a loop $g$ homotopic to $f$ such that $g(I)\subseteq A$. 
What really bothers me about this is how I could homotopy form a homotopy from $f$ to $g$ consisting of possibly infinitely many individual homotopies from $f_i$ to $g_i$. I believe I need there to only be finitely many $f_i's$, but I don't see how to show it. 
Note: This is not homework.
 A: Proof with Yoyo's suggestion
Since $X$ is defined to be the result of attaching an $n$-cell to $A$ via some attaching map $\varphi:\partial D^n\rightarrow X$, it has the form $X=A \amalg e^n/\sim$, where $x\sim \varphi(x)$ for all $x \in \partial D^n$. Note first that since $A$ and $e^n$ are path connected, the adjunction space $X=A\cup_\varphi e^n$ is also path connected. As such, our choice of base point does not affect the structure of $\pi_1(X)$, so let $x_0 \in A$ be the base point of $\pi_1(X)$ we are working over. Let $f \in \pi_1(X,x_0)$. Let $E=\text{Int}(e^n)$ and consider $f^{-1}(E)$. This is an open subset of $(0,1)$, so it is the union of a possibly infinite collection of subsets of $(0,1)$ of the form $(a_i,b_i)$. Let $x \in E$ and let $U$ be an open ball around $x$ in $e^n$. Like before, $f^{-1}(U)$ is an open subspace of $(0,1)$, so it is of the form $(c_i,d_i)$ for possibly an infinite number of $i$'s.  The preimage $f^{-1}(x)$ is a closed subspace of $I$, hence it is compact. The intervals $(c_i,d_i)$ form an open cover of $f^{-1}(x)$, hence a finite collection of these intervals cover $f^{-1}(x)$. Let $f_i$ denote the restriction of $f$ to $(c_i,d_i)$. Note that $f_i$ lies in the closure of $U$ and, in particular, $f(a_i)$ and $f(b_i)$ lie on the boundary of $U$. For $n\geq 2$ we can homotopy $f_i$ to the path $g_i$ from $f(a_i)$ to $f(b_i)$ in the closure of $U$ which is disjoint from $x$, since the closure of $U$ is homeomorphic to $D^{n}$, a closed and convex subset of $\mathbb{R}^n$. This gives a homotopy from $f$ to the path $g$, which is disjoint from $x$. Since $g$ is not surjective, it is homotopic to a path $h$ contained entirely in $A$. 
A: If you have a little knowledge of the Van-Kampen theorem then you can prove it like this: You have $A \subseteq X$ and you are attaching an $n-cell$ $e^n$. Now recall that you have a characteristic map $\Phi : D^n \to X$ that restricts to $\varphi$ on $S^{n-1}$. We know that $\Phi$ is a homeomorphism between the interior of $D^n$ and its image. So set 
$$V = \textrm{Im}\left(\textrm{int}(D^n)\right),\hspace{4mm} U = X - \Phi(\textrm{origin}).$$
Now $V$ is the continuous image of a path-connected space, and $U$ is also path - connected. Their intersection is homeomorphic to the image of $\textrm{int}{D^n} - \{\text{origin}\}$ that is path connected. Furthermore $X = U \cup V$, and choosing some $x \in U \cap V$ as our basepoint the Seifert Van Kampen theorem now gives that
$$\pi_1(X,x) \cong \bigg( \pi_1(U,x) \ast \pi_1(V,x)\bigg)/N$$
where $N$ is some normal subgroup in the free product. Now because $U$ is homotopy equivalent to $A$ and $\pi_1(V,x) = 0$ , it follows that
$$\pi_1(X,x) \cong \text{some quotient of $\pi_1(A,x)$}$$
via the induced map $\overline{i_\ast}$. Now $i_\ast = \overline{i_\ast} \circ g$ where $g : \pi_1(A) \to \pi_1(A)/N$. The composition of two surjective maps is surjective, from which it follows that $i_\ast$ is surjective.
A: Since $\pi_1(S^n) =0 $ for $n>1$ so all elements of $\pi_1(X)$  can be realized as an element os $\pi_1(A)$.
