To your second question, one way to do this is to put both sets in an object. First of all, this means don't write to CSV during the script unless you need it for reference later. That's a waste of disk space. Do the work in memory, and write out to CSV if you want as the output at the end. Then use sort-object and compare-object cmdlets, or the contains operator. You might want to read the help files on all of these, there are examples.
So, let's say you have two sets:
$a = 'one', 'two', 'three'
$b = 'blue', 'black', 'three'
Compare-Object -ReferenceObject $a -DifferenceObject $b -IncludeEqual
InputObject SideIndicator
----------- -------------
three ==
blue =>
black =>
one <=
two <=
PS> $a -contains 'three'
True
Hope this helps