I'm attaching a sample project implementation on the requirement you posted. You can customize this baseline implementation to meet additional requirements if needed.
The scripts using SharedModelMap is in the VSI match script. I have created three transactions in the VSI:
API_A - Response X or Response Y
API_B - Response X
API_C - Response Y
Each of them have a match script where we are caching the sessions so that we can look it up to see which response to return in a subsequent API call. API_A match script has the core of the script and reads in the response dynamically from a file. The file selection is based on the condition that API_B or C was called.
Since I am dynamically reading in the contents of the response payload for API_A, I had to create a MAR Info file so that I can include these external response files when I deploy the virtual service.
So when you test this sample project, be sure to deploy the virtual service by right clicking on the MAR Info file (.mari) and deploy the virtual service using this file