intersection of two sets using append and duplicates