Bash to expect script to add user


Need help Required to convert below bash script in expect script.


#Script to Add User
tail /etc/passwd | cut -d: -f1
read -p 'Please Enter The Username To Add: ' name
echo "$name" > /tmp/userlist.txt
clear
echo -e "Hallo $namenYour Name Is Added To The List."
userfile=/tmp/userlist.txt
username=$(cat /tmp/userlist.txt | tr 'A-Z' 'a-z')
for user in $username
do
useradd $user -N -s /bin/bash
usermod -aG sudo $user
passwd $user

sed -i "s/tui/tui $user/g" /etc/ssh/sshd_config
sed -i "s/$user.*$user/$user/g" /etc/ssh/sshd_config
sed -i "s/tui/tui $user/g" /etc/security/access.conf
done
echo "=================================="

echo "User $name Have Been Created."

echo "=================================="
tail /etc/passwd | cut -d: -f1