I am trying to create output which keeps hostname,ssh protocol and root login information with bash script.

And I would like to do it with developing functions. I developed .sh but it does not work. 

Could you please help me to find out where is the problem in this sh?

Server Version **Red Hat 7**

my expected output should be;


**xyz|hostname|Protocol X|Root Access Denied**

And I would like to start to output **"xyz"** in order to pars my out but.

                 #!/bin/bash
                 
                 
                 host(){
                 local tmpfile=$(mktemp)
                         hostname > "$tmpfile"
                 printf '%s' "$tmpfile"
                 }
                 
                 protocol(){
                 local infile="$1"
                 
                 cat /etc/ssh/sshd_config  | grep Protocol}
                 
                 rootlogin(){
                 
                 local infile="$1"
                 
                 if [[ $(sudo cat /etc/ssh/sshd_config | grep -i "PermitRootLogin yes" | grep -v "#PermitRootLogin yes") = "PermitRootLogin yes" ]]; then
                                       echo  $host
                               else
                                       echo "Root Access Denied"
                 fi
                 }
                 
                                                 }
                 
                 
                 tmpfile=$( host )
                 
                    {
                         host "$tmpfile"
                         protocol "$tmpfile"
                         rootlogin "$tmpfile"
                 } > fonk.out
                 
                 rm -f "$tmpfile"