Why my Set Array Elem function is not working?

What is wrong with this function?

ok it is correct the problem is order of the function.