In general, your problem is not how you're attempting to access the last member of the array. SugarCube is mostly a thin layer over JavaScript, so the syntax is exactly the same.
Your problem is that the system used by the <<textbox>> macro to resolve the variable you're passing it only supports static identifiers and variables within the square bracket notation. Meaning, the arithmetic you're performing there is unsupported.
The following should work as long as you're attempting to use it within the same passage:
<<set _ref to $myArray[$myArray.length - 1]>>\
<<textbox "_ref.name" "">>
It works by taking a reference to the object within the array and passing that to the macro.
Alternatively. If you use a button/link to move to the next passage you could do something like the following instead:
<<textbox "_name" "">>
<<link [[Continue|Some other passage]]>>
<<set $myArray[$myArray.length - 1].name to _name>>
<</link>>