"which" command output into a variable does not work

The variable only accepts the value sent through STDOUT, or the output stream. Since curl cannot be found, the output you are seeing is an error message sent through STDERR or the error stream. If you wish to store the error message in the variable in the case of an error., do the following:

OUTPUT="$(which curl 2>&1)"

This directs all data from STDERR to STDOUT. 2 is the file descriptor for STDERR and 1 is the file descriptor for STDOUT.