Maybe I'm missing something but this seems overly complex :-) Since _name is a string in the first place, the format operation serves only to return its value. You should be able to just write...
_name = _this
_unit = call _name
#loop
@!alive _unit
@alive call _name
_unit = call _name
_c = 0
while "_c < 4" do {_unit addmagazine {ak74}}
goto "loop"
Of course, it would also be nice to be able to automatically obtain _name from the object itself but the 'name' function returns something completely different :-(