What’s your date of travel? Trains are only sold 2 weeks in advance.
if outside China, use trip.com to purchase.
if desired day is sold out, just keep an eye on tickets, availability will change throughout the 2 weeks in the lead up to travel date. Change policies are fairly good, can be easier to cancel and rebook instead of changing.
Yangshuo train station is about 45 minutes away from Yangshuo city. Didi or taxi will be easiest. $14 didi. Guilin train station is about 75 minutes from Yangshuo, $32 didi.
Another option is to do a river cruise from Guilin to Yangshuo which is a classic choice, usually during lunch time. 4-5 hours. Very scenic including seeing the image on the back of the 20 RMB bill