For the beginners who will also encounter this kind of problem:
COUNTER=1
while true; do
FILENAME="/home/ubuntu/scriptoutput/HELLO($COUNTER).txt"
if [ -e $FILENAME ]; then
COUNTER=$((COUNTER+1))
else
break
fi
done
(
printf "hello"
) > $FILENAME
for those who answered, thank you so much :-)