During Partitions of Poland, Zbaraz was a part of Austro-Hungarian Empire and there weren't good railway connections between Galician towns and those at Russian side, also because of different breadth of rails.
This way I believe your grandmother could use the railway connection between Tarnopol and Krakow, which was part of Galician Railway of Archduke Charles Louis. And from there she could take another train going through Kielce to Warsaw, as from what I know, that was the easiest way.
You can see the possible route on the linked map, which shows the state of connections in 1897. Here's its smaller version:
As for the next part, between Warsaw and Gdansk, this map of German railways in 1899 can provide some details:
The main differences that could change the possible way after 1899 were the development of Russian railways in the first decade of 20th century and the overall development and changes in railways during the World War I.
Still, take in mind that when the war finished, there were only a few rail connections between areas of Poland that were previously parts of different empires. So it was much easier to go by train from Polish town to another country than to another Polish town.
It's possible that she didn't take the train from Warsaw, as many Polish peasants who tried to emigrate were crossing the border illegally, paying the bribe, which was was much easier on smaller routes. With the help of Google you can translate this post from Polish genealogy board speaking about Polish emigration to USA in the end of 19th century, which covers this subject among others.
Of course it could look pretty different in the times of World War I.
Also are you sure about Gdansk? Because at the same article it's written that at the end of 19th century the main ports from which Poles were leaving to USA were Bremen, Antwerp and Hamburg.
EDIT: I've found the following map, showing ports from which emigrants from another Galician town, Świlcza, were coming to New York between 1897 and 1924. As we can see, there's also Gdansk on the list, even if the numbers show it was much less popular option.
More details at the linked website in Polish language.
You should also read another website, containing local press articles in which Galician citizens write about their road to USA. The first one (1902) was written by journalist who focuses on the ship itself, but the more interesting is the second relation (1903), describing how emigrants from Galicia were treated in Germany on their way in trains and in the ports.
And a third press article, from 1890, describing relations from the port in Bremen, how Polish emigrants were treated. I suppose it would be similar in Gdansk.
And finally the book by Martin Pollack, "Caesar of America", describing Galician emigration to USA before 1918. Originally it's in German, it was translated to Polish and it's possible that to English too.