When the object is at 0 displacement and max speed v0, all of its energy is kinetic. Therefore, you can find the total energy of the system by just computing the kinetic energy (1/2)mv0^2 at this instant.
Alternatively, a quarter of a period later, when the object is at max displacement A and 0 speed, all of the kinetic energy that it had has been converted into elastic potential energy in the spring. Therefore, at this instant, you can compute the total energy of the system simply by computing the elastic potential energy (1/2)kA^2
Both of these expressions will give you the same answer for the total energy of the system, so you would use one, or the other, but not both.
The expression for the total system energy at an arbitrary time t is just the sum of the kinetic and potential energy of the mass:
E = (1/2)kx^2 + (1/2)mv^2
Where "x" is the position at time t, and "v" is the speed at time t. However, it is easiest to pick a time t where one of these two energy terms is zero, like I did in the two cases above. The first case was for x=0, v=v0. The second case was for x=A, v=0. Do you understand now?
One more thing. I notice that you used "y" instead of "x" to denote the position of the mass. This suggests to me that the mass is oscillating vertically. If that's true, then you need to consider *gravitational* potential energy as well.