Set Array Elem not working when using function

Hi, newbie here. I would like to ask about Set Array Elem.

I want to use function to set array elem, however I unable to do it.
Below I upload the findings I get.

Hence would like to need some help or other solutions.

Thanks in advance.