You should write a python script for that, not bash, it will be easier. Something like:
Code:
import subprocess
users = tuple(filter(None, open('users.txt').read().splitlines()))
if users:
subprocess.check_call('systemctl stop calibre-server'.split())
for user in users:
username, password = user.split()
subprocess.check_call(['calibre-server', '--manage-users', '--', 'add', username, password])
subprocess.check_call('systemctl start calibre-server')