User info gathering for remote server


need to gathering user info date wise.

dtStr=date +%d-%B-%y
file = “/etc/passwd”
while read -r line
UserName=echo $line | cut -d: -f1
echo “$hostName,$UserName,$dtStr”
done < “/etc/passwd”

above command able to get info but from remote machine how to capture.
remote machine to client server having password less.


can any one help me on this. need to compare the data date wise.