ejabberd – How start ejabberdctl from bash script properly?

I need to register many thousands of users in ejabberd from csv file. For this, I wrote a simple script.

#!/bin/sh
OLDIFS=$IFS
IFS=','
[ ! -f $INPUT ] && { echo "$INPUT file not found"; exit 99; }
while read username domain pass p1 p2 p3 p4
do
    echo "ejabberdctl register $username $domain $pass"
    ejabberdctl register $username $domain $pass
done < users.csv
IFS=$OLDIFS

But in the end, the answer is: Error: cannot_register If I just run the line copied from the output, everything is ok. The user is created normally.