My attempt
- $(\forall x.P(x))\land(\forall y.P(y) \implies Q(y))$ [premise]
- $\forall y.P(y) \implies Q(y)$ [$\land$ elim 1]
- $\forall x.P(x)$ [$\land$ elim 1]
- $a, P(a)$ [$\forall$ elim 3]
- $a, P(a) \implies Q(a)$ [$\forall$ elim 2]
- $Q(a)$ [$\implies$ elim 4,5]
- $\forall z.Q(z)$
I feel steps 4-5 is not correct, because we used a for two different expressions. I'm also not so sure about whether it's okay to go from step 6-7. Could anyone tell me whether what I did is correct and if not how I should fix it?

I would justify your steps 4 and 5 with "universal instantiation" and write down that $a$ in step 5 is the same $a$ as in step 4. (If step 2 is true for all $y$, then it is certainly true with the assignment $y = a$ for the same $a$ as in step 4.) Then step 6 is modus ponens on steps 5 and 4. (Not everything is elimination.) Then step 7 is universal generalization applied to 6.
But otherwise, this seems fine.