For an undamped block-spring oscillator, the total energy remains constant throughout and is equal to $$E_{tot}=\frac12kA^2+\frac12mv_{\max}^2$$ This energy moves back and forth between the kinetic and spring potential energies: $$\begin{align} E_{tot} &= E_k + E_s\\ &= \frac12 m(v(t))^2 + \frac12k(y(t))^2\\ \end{align}$$ where $y(t)$ is the displacement of the block, and $v(t)$ the velocity, at a given time $t$.