Liquid only works on the server side, so you can't change the button when a variant is selected using liquid. For that you'll need to add some JavaScript to handle the button content on variant change.
How you can do that will depend on the code that handles the variant selectors. Usually, theme developers dispatch custom events on variant change, but if the code is minified it will be hard to get the event's name.
If the URL changes on variant change, you could try using the postate event.