I don't think that is the problem.
Code:
cat test
line1
line2
line3
Code:
while read line; do
> echo $line
> while read entry; do
> echo $entry
> done <test
> done <test
line1
line1
line2
line3
line2
line1
line2
line3
line3
line1
line2
line3
One problem with what you have posted is that if a line contains whitespace, the shell will break up $cos.
It also seems strange that you have a subdirectory in /root/. In linux /root is the home directory of the root user and you shouldn't be running normally as root. Did you mean to type "/home/" instead?
It also looks like some of the programs like diff and cmp from coreutils may be able to do what you want. I'm just guessing from the title of your script.