The Snippet tool works well for uploading an image, that contains the source. You coded your application to write the same unit information for each channel. If you want it to change you can use something like a case structure in the for loop, which has a different value, depending on the channel name.
Or you could have a 1D array of string constant, auto-indexed into the for loop, where each element in the array corresponds to the unit to be used for each channel. Of course for this to work the two arrays must be of the same size. For this reason the case structure might be the better option, because you could have a Default case that sets an unspecified channel to some default unit.