How do you determine if a line in $myfile matches the user input?
How is the user input accessed in your program? (Command line argument? Command line option? String read from a file? String prompted for and read from standard input? ...?)
Rather than just showing us code that is not working, describe what you are trying to do with foreach ($PxyType in "${DIR}"/"File.json") .
You have said you want to produce thousands of files named File1,2,3..json and *.json . Both of these specifications are ambiguous. What filenames are you trying to produce?
Please show us small, representative sample input files (using CODE tags), sample input the user might supply (using CODE or ICODE tags), and the names and contents of the output files that should be created from those sample inputs (using CODE tags).
This is far from clear to me. On top of what Don Cragun said,
Where do you use $PxyType?
Where do you read from $myfile?
Your sed snippet will NOT consistently retrieve all and only proxytypes. It will (by accident) if supplied with your sample but fail on more general files.
Nothing in your sample will match what you call the xml path.
What be the directory structure for your individual files?