You use .append() which is for lists, but duplicateFiles is a set. You should use try add() instead of .append().
.append()
duplicateFiles
add()
You can read more about sets here or here