(among other things this will complain about the undeclared global variable $RootFound) .. after that, I'm confused as to why $LoadCreateFile is opened for writing and _clobbered_ each time.. that will result in just 1 set of print's ever being in there..
(i meant to ask earlier) could you post a sample of the output you're currently getting and a sample of the desired output?