Reporting, how to?

I am new to Okla but am a LDAP admin. I’ve been tasked on verifying 4000 accounts to verify their existence in Okla. How would i go about this? We would like to keep this simple, a bash shell script if possible. Can anyone share an example of retrieving data based on an input file?
something along the lines of this:
while read input
do
reteive information
write to csv file
done <input.file

Do a pagination loop via the users API:

$uri = “https://[tenant].okta-emea.com/api/v1//users”

DO

{

$webrequest = Invoke-WebRequest -TimeoutSec 300 -Headers @{“Authorization” = $apiKey} -Method Get -Uri $uri

$link = $webrequest.Headers.Link.Split("<").Split(">")

$uri = $link[3]

$json = $webrequest | ConvertFrom-Json

$allusers += $json

} while ($webrequest.Headers.Link.EndsWith(‘rel=“next”’))

$activeUsers = allusers | Where-Object { _.status -ne “DEPROVISIONED” }

$activeUsers | Sort-Object lastLogin | Select profile, lastLogin | Export-Csv -Path C:\Users.csv -NoTypeInformation