Writing to multiple volumes can be done using a single volume wrangle without any loops.
Restrict the heigthfield or volume wrangle's group parameter to the name of the volumes you want to write to, eg. @name=mask*. Activate the tickbox "Bind each volume to density" which will write to all specified volumes at once and pretend your volumes are named "density" accordingly. In this case we sample another volume from the second input which is also called "mask" to a set of smaller volumes tiles:f@density = volumesample(1, 'mask', v@P);
Enter density in the "Volumes to write to" parameter field.