The issue is that you have parsed the json in the template, what you want is:
##velocity template
#set($output=$input.json('$.output'))
#set($context.responseOverride.status=$input.path('$.output.statusCode')
The .json function of the input object will convert it to a json string istead of an object internally in VTL