You are right to suspect that your described method does not work to prove the Deduction Theorem: if you simply extend the existing deduction of $B$ from $\Delta \cup \{ A \}$ by adding $B \rightarrow (A \rightarrow B)$ (from axiom 1) and then getting $A \rightarrow B$ through Modus Ponens, then all you have ended up showing is that there is a deduction of $\Delta \cup \{ A\} \vdash A \rightarrow B$, because the original set of premises is still $\Delta \cup \{ A \}$. And you can't just throw out the $A$, since in the extended derivation, you still need to get to $B$ by itself, which may well depend on $A$.
So ... you need to do something else to show $\Delta \vdash A \rightarrow B$
Here is what you need to do. Transform the deduction of $\Delta \cup \{A \} \vdash B$ into a deduction of $\Delta \vdash A \rightarrow B$ by showing how you can get a deduction $\Delta \vdash A \rightarrow \varphi_i$ for $\varphi_i$ of the original deduction. And that you can show by strong induction, where you have to consider that every $\varphi_i$ comes about as one of the three cases: as an element of $\Delta$, an instance of some axiom, or by the use of Modus Ponens.
Here is a simple example:
If we take that $\Delta = \{ A \rightarrow B \}$, then we know that $\Delta \cup \{ A \} \vdash B$, i.e. that $\{ A \rightarrow B, A \} \vdash B$. Indeed, here is a derivation for that:
\begin{array}{ccc}
1 & A \rightarrow B & Given\\
2 & A & Given\\
3 & B & \text{Modus Ponens } 2,3
\end{array}
OK, so now we want to convert this to a derivation of $\Delta \vdash A \rightarrow B$, i.e. of $\{ A \rightarrow B \} \vdash A \rightarrow B$
Now, there is of course a very simple derivation for $\{ A \rightarrow B \} \vdash A \rightarrow B$, but what I want to show below is that we can systematically convert the earlier derivation of $\{ A \rightarrow B, A \} \vdash B$ into a new derivation of $\{ A \rightarrow B \} \vdash A \rightarrow B$
Again, the basic idea is that, since we are 'pulling out' $A$ from the set of assumptions, in the new derivation we want to get a statement of the form $A \rightarrow \varphi_i$ for every line $\varphi_i$ from the original derivation. Think of this as 'conditionalizing' every statement with the condition $A$. So, the basic scheme for the derivation will look like:
\begin{array}{ccc}
..\\
k & A \rightarrow (A \rightarrow B) & ??\\
..\\
l & A \rightarrow A & ??\\
..\\
m & A \rightarrow B & ??
\end{array}
Now, notice that the last line is $A \rightarrow B$, which is exactly what we are trying to get, so that's already good. But of course, we have yet to figure out how to actually get there. In fact, let's first enter the givens, which are all the same givens as in the original derivation, excvept for $A$, since that's the one we're 'pulling out':
\begin{array}{ccc}
1 & A \rightarrow B & Given\\
..\\
k & A \rightarrow (A \rightarrow B) & ??\\
..\\
l & A \rightarrow A & ??\\
..\\
m & A \rightarrow B & ??
\end{array}
OK, now, note that we put down line $k$ exactly because we had line $1$ as a given in the original derivation. That is, for tevery $\varphi_i \in \Delta$, we put down, and are trying to get to, $A \rightarrow \varphi_i$ .. how can we do that? Easy: just exploit axiom $1$:
\begin{array}{ccc}
1 & A \rightarrow B & Given\\
2 & (A \rightarrow B) \rightarrow (A \rightarrow (A \rightarrow B)) & \text{ Axiom } 1\\
3 & A \rightarrow (A \rightarrow B) & \text{ Modus Ponens } 1,2 \\
..\\
l & A \rightarrow A & ??\\
..\\
m & A \rightarrow B & ??
\end{array}
Now, the $A \rightarrow A$ is because the $A$ was in the original set of givens as well, but since in the new derivation we no longer have $A$ as a given, we need to derive $A \rightarrow A$ in a different way. But, as you found, such a derivation can always be done:
\begin{array}{ccc}
1 & A \rightarrow B & Given\\
2 & (A \rightarrow B) \rightarrow (A \rightarrow (A \rightarrow B)) & \text{ Axiom } 1\\
3 & A \rightarrow (A \rightarrow B) & \text{ Modus Ponens } 1,2 \\
4 & (A \rightarrow ((A \rightarrow A) \rightarrow A) \rightarrow ((A \rightarrow (A \rightarrow A)) \rightarrow (A \rightarrow A)) & \text{ Axiom } 2\\
5 & A \rightarrow ((A \rightarrow A) \rightarrow A) & \text{ Axiom } 1\\
6 & (A \rightarrow (A \rightarrow A)) \rightarrow (A \rightarrow A) & \text{ Modus Ponens } 4,5 \\
7 & A \rightarrow (A \rightarrow A) & \text{ Axiom } 1\\
8 & A \rightarrow A & \text{ Modus Ponens } 6,7 \\
..\\
m & A \rightarrow B & ??
\end{array}
OK, almost done. Now we need to show how line $m$ can be derived from the original lines $k$ and $l$, i.e. lines $3$ and $8$. Well, for this you use axiom 2. That is, since in the original derivation we went from $A \rightarrow B$ and $A$ to $B$ via Modus Ponens, in the new derivation we need to do this using the conditionalized statements, i.e. we need to go from $A \rightarrow (A \rightarrow B)$ and $A \rightarrow A$ to $A \rightarrow B$. How do we do this? Well, this is exactly what Axiom 2 is for: Axiom 2 always looks a ittle weird if you first see it, but Axiom 2 is actually the embodiment of this kind of 'conditionalized Modus Ponens'. Here is how it goes:
\begin{array}{ccc}
1 & A \rightarrow B & Given\\
2 & (A \rightarrow B) \rightarrow (A \rightarrow (A \rightarrow B)) & \text{ Axiom } 1\\
3 & A \rightarrow (A \rightarrow B) & \text{ Modus Ponens } 1,2 \\
4 & (A \rightarrow ((A \rightarrow A) \rightarrow A) \rightarrow ((A \rightarrow (A \rightarrow A)) \rightarrow (A \rightarrow A)) & \text{ Axiom } 2\\
5 & A \rightarrow ((A \rightarrow A) \rightarrow A) & \text{ Axiom } 1\\
6 & (A \rightarrow (A \rightarrow A)) \rightarrow (A \rightarrow A) & \text{ Modus Ponens } 4,5 \\
7 & A \rightarrow (A \rightarrow A) & \text{ Axiom } 1\\
8 & A \rightarrow A & \text{ Modus Ponens } 6,7 \\
9 & (A \rightarrow (A \rightarrow B))\rightarrow ((A \rightarrow A) \rightarrow (A \rightarrow B)) & \text{ Axiom } 2\\
10 & (A \rightarrow A) \rightarrow (A \rightarrow B) & \text{ Modus Ponens } 3,9 \\
11 & A \rightarrow B & \text{ Modus Ponens } 8,10
\end{array}
.... and we're done!
OK, so this was just a simple example, but I think you can see how this general technique always works: Your goal is to conditionalize all statements from the original derivation with the '$A$' that you pull out, and you derive those as follows:
Derive $A \rightarrow A$ for that $A$.
Derive $A \rightarrow \varphi_i$ for every $\varphi_i \in \Delta$ using the $\varphi_i$ you still have as a given in the new derivation, and using axiom 1.
Derive any $A \rightarrow \varphi_k$ where in the original derivation $\varphi_k$ was derived using Modus Ponens from earlier $\varphi_i$ and $\varphi_j = \varphi_i \rightarrow \varphi_k$ from the conditionalized $A \rightarrow \varphi_i$ and $A \rightarrow \varphi_j = A \rightarrow (\varphi_i \rightarrow \varphi_k)$ using axiom 2
Best Answer
Natural deduction systems generally have a notion of assumption introduction and discharge. The easiest-to-understand rule that needs this is $\to$-introduction. This says that if we can assume $A$ and then prove $B,$ then we can infer $A\to B$ and discharge the assumption $A,$ leaving us with an unconditional proof of $A\to B$ (i.e. a proof from the empty set).
The exact nature of how the rules work and the proofs are laid out varies from system to system. For instance, see the hypothetical derivations section of the wikipedia page.
A couple more things