in reply to loop exits after printing the file

What happens if you add ...." or die $!;" to the corresponding open(...) in sub create?

It's also a good idea to close the files (flush data) when writing is done and before re-opening the files for reading. Add

close HTML1; close HTML2; close FILE;
at end of sub create.