I am replying with simple pseudo code bellow, plz work on it.

Read records of File-A one by one and chk it with all records of File-B.
If it matches then write to File-C else write to File-D.