Hi,
in Bar in Montenegro there is no other railway line than back to Beograd.
You can use bus service (not included in the pass) to Dubrovnik (croatia) to visit the city and from there directly to Split. From there trains to Zagreb and 3 times the week nighttrain to Graz, Vienna, Bratislava or Budapest.
You can also use from Ploce (between Dubrovnik and Split) a train to Mostar and Sarajevo. The train Ploce-Sarajevo is between Ploce and Metkovic (croatian part) not included in the pass. Tickets on board the train.https://www.zfbh.ba/en/voz-sarajevo-ploce-sarajevo-ponovo-od-02-06-do-27-08-2023-godine/
Keep in mind that there are no other international trains between Bosnia and Herzegovina, Croatia, Serbia or Montenegro.
Also possible is from Bar to get to Albania and Greece, Kosovo or North Macedonia by bus (not included in the pass).