How to get output from a gh file run in headless mode

Initially my code worked but I want to run my whole project in headless mode(using rhinocompute)

  GH_Document ghDoc = new GH_Document();
            GH_DocumentIO gd = new GH_DocumentIO();
            bool t = gd.Open(ghxFilePath);
            ghDoc = gd.Document;
            Instances.ActiveCanvas.Document= ghDoc;
var outputParameter=inputComponent.Params.Output;

When running in headless mode, outputParameter only the datatype as mesh but not the data.
How to get it?