Isso está funcionando.
#!/bin/bash
OUTPUT=$(cat /etc/passwd | grep -v nologin | grep -v root | awk -F: '{ print
$1 }')
block1='hostname'
while read -r line
do
if [[ 'sudo -l -U $line | grep NOPASSWD' ]];then
echo $block1 $line
else
echo $block1 $line
fi
done <<< "$OUTPUT"