due to the behavior of String.replace(), only the first occurrence of $FILE is replaced. The builder should replace all occurrences of $FILE.
Maybe use regex inside replace instead? Like this: http://stackoverflow.com/questions/2116558/fastest-method-to-replace-all-instances-of-a-character-in-a-string
Best