Then I expect it will loop A, B, C, & D values. Though it is appending to the same file, it is not looping values C & D.
It is something like in JAVA, you have data structure as vector. You can iterate & populate at the same time. So in iteration, you can as well iterate the recently added value.
this should iterate the recently added value. but make sure that you add a condition in the while loop to exit or else it might go to infinite loop. Might be you could add a counter variable to exit after running the loop for specific number of times.
while read fname ; do
echo x >>$filename
done <$filename