As your example below shows, we cannot assume in all cases that $H \le \langle a_1 \rangle$ as I asserted previously, but I'll explain how to do that case anyway.
To avoid all the notation, I will consider two specific cases, one where it is not possible and one where it is possible. That should be enough to enable you to solve it in general. I am going to call the generators $a,b$ rather than $a_1,a_2$.
First suppose that $|a|=32$, $|b|=4$, and $|H|=4$, so $H = \langle a^8 \rangle$. Suppose $\phi \in {\rm Aut}(G)$ with ${\rm Fix}(\phi) = H$. Since $\phi(b^2) \ne b^2$ or $a^{16}$, we must have $\phi(b^2) = a^{16}b^2$. Also, since $\phi(a^8) = a^8$, we must have $\phi(a^4)^2 = a^8$, and so $\phi(a^4) = a^4, a^{20}, a^4b^2$ or $a^{20}b^2$. The first is not possible, since $a^4 \not\in {\rm Fix}(\phi)$. If $\phi(a^4) = a^{20}$, then $\phi(a^4b^2) = a^4b^2$, which is not possible because $a^4b^2 \not\in {\rm Fix}(\phi)$. The other two possibilities are ruled out by the fact that $a^4$ is a $4$-th power, but neither $a^4b^2$ nor $a^{20}b^2$ is a $4$-th power. So there i no such $\phi$ in this case.
Now suppose that $|a|=32$, $|b|=4$, and $|H|=8$, so $H = \langle a^4 \rangle$. Then we can define $\phi$ with ${\rm Fix}(\phi) = H$ by $\phi(a) = a^{25}b$, $\phi(b)=a^8b^3$.