".first" is kind of convenient method. Answer for the UI query comes as an array. So the ".first" represent the first element of the array. There are few methods like ".count"
Ex: your Query :
ans = query("button",:accessibilityLabel)
Assume You will get result like this
[
[0] "icon rewards new",
[1] "icon my receipts new",
[2] "icon my account",
[3] "icon order@2x",
[4] "icon check in"
]
if you use ".first" like this
ans2 = query("button",:accessibilityLabel).first
you will get a String with first element as a result instead of an array.
"icon rewards new"
Now you can see you get the first element as the answer