Say we are given a matrix $A$ over the field $\mathbb{C}$ with minimal polynomial $\mu_A(\lambda)=\lambda^2(\lambda-1)^2$ so we know $A \in \mathbb{C}^{m \times m}$ where $m \in \mathbb{N}_{\geq 4}$. Then if we were to find a formula for $A^n$, we let $h(z)=z^n$, we want to find a degree 3 polynomial
$$ g(z) = \alpha_0 + \alpha_1\cdot z + \alpha_2\cdot z^2 + \alpha_3\cdot z^3. $$ We known that $g(0) = h(0), \;g'(0) = h'(0),\; g(1) = h(1),\; g'(1) = h'(1)$ (from our minimal polynomial). This gives $g(z) = (3-m)z^2 + (m-2)z^3$. Does this mean that $$ A^m = (3-m)\cdot A^2 + (m-2)\cdot A^3, \; m\in \mathbb{N}_{\geq 4}. $$ Does this formula work, I'm unsure of the logic behind Lagrange Interpolations.
Just to make sure my computation is correct we get 4 equations $$ 1=\alpha_0 + \alpha_1 + \alpha_2 + \alpha_3 \\ m= \alpha_1 + 2\alpha_2 + 3\alpha_3 \\ 0 = \alpha_0\\ 0 = \alpha_1 $$ thus $a_3 = m-2, \; a_2 = 3-m$.
You should have made an error in your computations as $\mu_A(z) = z^4-2z^3+z^2$ and therefore
$$z^4= 1 \cdot \mu(z) + 2 z^3 - z^2$$ which doesn't match
$$(4-m)\cdot z^2 + (m-3)\cdot z^3$$ for $m=4$.
Your error is that $h_m^\prime(z) = \left(z^m\right)^\prime = m z^{m-1}$. So $m= \alpha_1 + 2\alpha_2 + 3\alpha_3$ and not $m-1= \alpha_1 + 2\alpha_2 + 3\alpha_3$.
And your overall logic is correct. You are doing the Euclidean division of $h^m$ by $\mu_a$, i.e.
$$h_m = q_m \mu_A + r_m$$ with $\deg r_m <\deg \mu_A$.
As $\mu_A(0)=\mu_A(1)=\mu_A^\prime(0)=\mu_A^\prime(1)=0$, the equations you used are correct to find $r_m(z) = (m-2) z^3 + (3-m) z^2$.
Note: as $h$ ang $g$ depend on $m$, better to use indices to name them.