Please use the following -
{% i=45;CMSContext.Current.GlobalObjects.Users[i].DisplayName#%}
You can also test Macro expression on System-
Refer this for Macro syntax from System--> Macros-->Console
https://docs.xperience.io/k12sp/macro-expressions/macro-syntax#Macrosyntax-Compoundexpressionsanddeclaringvariables