Your code does not have enough states. You have a 2nd order ODE (the highest derivative present is 2), so the state vector needs to be two elements, not one element as you have it. You will need to carry both y and y' at each step. To keep with your outline, let's make the state a column vector, and then have the result in a matrix where the columns are the states at each time point. I.e., y(1,i) is the y at time x(i), and y(2,i) is the y' at time x(i). Then take your code and everywhere you see y you need to replace it with a column vector. E.g.,
y(:,1) = [1;yprime_initial];
dy = [ y' at time x(i); y'' at time x(i) ];
y(:,i+1) = y(:,i) + dy*h;
I modified almost everything in your code to account for the 2-element column vector states. I even included the outline of what the 2-element column vector dy needs to be in terms of y' and y''. You simply need to fill in the values for these. It will be a function of the current column vector state y(:,i) and time x(i). Give it a shot and let us know if you have problems. I have arbitrarily given the inital y' value as yprime_initial, but you should change this to the actual value.