I use this (and in keeping with the MS Windows key for reverting I bind it to <f5>). It's similar to what you're using, but not quite the same. I've been using it for a l o n g t i m e .
(defun revert-buffer-no-confirm ()
"Revert buffer without confirmation."
(interactive) (revert-buffer t t))
You're confusing the echoing of the return value by M-: with the action of M-x.
M-: expressly evaluates a sexp and prints the resulting value. M-x invokes a command.
Your command does not, itself, print or echo or otherwise display its return value.
If you want your command to echo the value, then use function message:
(let ((val (...