Generate multiple outputs from the list of inputs

Please find the below sample script. In this script have given single input $Name to generate the unique loginname.

However,for instance if import the multiple name list from the CSV under $Name, how do pass the each name from the list to the function to generate the unique loginname and store each ouput unique loginname to the CSV.

Sample Script:

$Name = "Sample Name"

## Declaring count to 0 .


#Generate unique login name
Function New($Count)
$Splitter = $Name.Split(' ')
$Add1 = $Splitter[0].Substring(0,1)
$Add2 = $Splitter[1].Substring(0,1)

0 {return $LoginName = $Add1+$Add2}
1 {return $LoginName = $Add2+$Add1}
default {return $LoginName = $Add1+$Add2+$Add1}

$loginName = New($i)
$ADresult = check-ADuser -loginName $loginName

}while($ADresult -ne 'True')