Actualy just copying values from list to set isn't correct solution. From Docs about Set "Represents a collection of unique elements with no duplicate values." List can contains duplicate values, Set not. So in FOR loop case you should also do check for set.contains(), so only if it false you can add value to the Set collection
Could you give more details or/and code samples of what exactly you're trying to do ?
Make for loop for list and add value in set collection.
From Docs about Set
"Represents a collection of unique elements with no duplicate values."
List can contains duplicate values, Set not.
So in FOR loop case you should also do check for set.contains(), so only if it false you can add value to the Set collection
Set<Account> accSET = new Set<Account>
For(Account acc : accLIst) {
accSet.add(acc) ;
}