The 01 taillight snapped into rubber grommets inserted into tabs which were a part of the grab bar. See it here
World of Powersports' 2001 Honda ATV TRX400EX Parts List
The 06 taillight had threaded studs that went through grommets in tabs on the frame. See it here
World of Powersports' 2006 Honda ATV TRX400EX Sportrax Parts List
You might have to get creative and weld a piece in place to attach the 06 light to.
I know the link says 2001, but 99 -04 were the same, they changed in 2005.