Virtual residues are used internally for a variety of uses. One of them is for loop modeling and CCD where virtual residues are used to close loops or keep chains from breaking.
In your case, there are two applications for modeling N and C termini. See the documentation for the FloppyTail and RosettaRemodel applications, as well as this post. https://www.rosettacommons.org/node/3840 Both can be used to do what you need. It will always depend on how long the loop is, if its structured or unstructured, etc. So read through the documentation of both, especially the limitations of FloppyTail for your specific modeling problem.