For example Assume your linux server running 4 postgres cluster so you want to create the postgres user to all cluster use below script to create user with specific privileges.
for K in {5432,5433,5434,5435}
do
psql -U postgres -d postgres -p $K <<DDL
CREATE USER khan IN ROLE role_name connection limit 50;
COMMENT ON ROLE khan IS 'fullname:khan mohammed';
\du+ khan
DDL
done