I have the code below in a file named traversal.groovy (which I call from the command line with gremlin -e traversal.groovy):
traversal.groovy
gremlin -e traversal.groovy
// Beg
You likely just need to iterate your pipeline:
http://gremlindocs.com/#methods/pipe-next
println v.outE.inV.name.next()