Question: Why isn't the code working properly?

restart:
 NEWTON_RAPH:= proc(f,z,M)
   local x,A:
    x := z:
    for A to M do:
      x :=  ( x - ( f ( x ) / D ( f ) ( x ) )  - ( ( ( ( D@@2 ) ( f ) ) * ( ( f( x ) ) ^ 2 ) n ) / ( 2 * ( D ( f ) ( x) ) ^3 ) ) )
       end do:
    evalf(x):
  end proc:
 f:= x-> x ^ 2 - 5:
 NEWTON_RAPH(f,1,10);
                                     1.

 

please someone help me i did each line of code seperately and they work fine but when i put it all together it just gives me one

Please Wait...