Hi Mani,
As you mentioned, Output type attaching can be done based on checks in output routines.
And If you want to modify the IDoc segment data, then the outbound IDoc FM will have customer exits which can be implemented according to business needs.
For example IDOC_OUTPUT_ORDRSP have customer exits EXIT_SAPLVEDC_002 for modifying SO item data segments, insert new or modify existing etc.
So you can identify and do as per your requirement.
Regards
Dwaraka