The "ssh-agent -k" command will emit shell commands that the shell must then execute which will kill the agent daemon and unset the socket environment variable.
If all you care about is killing it, you don't need to eval the output. The output just unsets two environment variables which only matters in the current shell context.
> The "ssh-agent -k" command will emit shell commands
Does it really? I've executed it here and it just runs kill, doesn't emit any bash. Running just ssh-agent (without any args) does that though, which is what's probably causing the confusion.
Because the intended use for "ssh-agent -k" is for eval.
While redirecting to /dev/null will certainly work, the agent is holding sensitive credentials (by design), and confirmation of shutdown has a tangible security benefit.