After much head-scratching (I originally wrote a "what are you asking here?" response, too), I decided that what the OP meant was:
If an ID occurs in only one file, print the corresponding line.
If an ID occurs in multiple files, and all the corresponding lines have the exact same text, print the line.
This does correspond to the sample output. (I'm still puzzled by 'unless one of the IDS was blank.')