The below code works 100% 105/105 what I need is to modify the script so that it

The below code works 100% 105/105 what I need is to modify the script so that it looks new plagiarized free but works perfectly on input/output test files attached and bash script.Please find the attached files.
Thanks