i need some help,hope you guys could help me!thanks

i write script below,but i just can't run it,hope you guys could help me! thanks

arr = $* as array

for j = 1 to arr.count do

(
M = arr[j].MATERIAL

m.name = arr[j].name

arr[1].NAME = "MT_" +m.name

for i = 1 to m.materiallist.count do

M.MATERIALLIST[I].name = M.NAME +"_mtl_" +(formattedprint i format:"02d")
)