I don't know the full context here, but if you do not want z(l1,l2) to be
replaced by the body of the function, evaluated, then don't define
z(l1,l2):=block ....
Instead leave it unevaluated.
You can define transformations by rules, e.g.
defmatch([a1,a2],true);
defrule(r1, z[a1,a2], something(a1,a2)]
and apply rule r1 only when you want to.
Again, I don't know much about the itensor package or what you
are trying to do here.
RJF