For a build that's in prod, whichever dev environment you built during the flow will still have that version of the code (that is until you build a new version of the code)...
But if you need to spool up a copy of your production scripts into your new "Test" dev environment, then just create a new library, choose "Test" from the environment drop down, give it a name and build it (all the prod resources and versions will be included as part of the "upstream" resources)
In the above flow, you don't need to add any resources. If you look at the library setting, there is a collapsed "upstream" resources.. if you expand this, you will see all the resources that are automatically part of the build.