get_output function

Obtain and store output