#!/bin/bash users=("user1" "user2" "user3") output_file="user_list.txt" for user in "${users[@]}"; do echo "Creating new user: useradd $user" echo "$user" >> "$output_file" done