The Lord told Moses,
Then the Tabernacle was dismantled, and the Gershonites and the Merarites set off, carrying it.
But they must not go in and look at the things that are most holy, even for just a moment, otherwise they'll die.”
“Register the descendants of Gershon, according to their family and father's line
It was in response to the Lord's instructions that they were registered by Moses. Each of those registered were told what to do and what to carry, as the Lord had ordered Moses.