OrientDB has types of collections and maps. To create a collection of a result set (which you are interested in), you should flatten it:
select flatten( shortestpath(" + firstVertex + ", " + secondVertex + ") )
There are so many ways to get the edges of outgoing edges. Below are some of them:
select vertices.out from (
select flatten( shortestpath(" + firstVertex + ", " + secondVertex + ") ) as vertices
)
:
select flatten( shortestpath(" + firstVertex + ", " + secondVertex + ").out )