Tom,
They may have been potato farmers in Donegal but in Scotland they would almost certainly have been working in some type of industry, earning a reasonable or tolerable wage.
One of Ireland’s problems is a lack of natural resources. There’s no coal, oil, iron ore etc, and so apart from a modest amount of shipbuilding in Belfast and the Belfast linen mills (which mostly only employed women), it did not really get the industrial revolution that benefited England and Scotland where mills, steelworks, ship building, coal mining and all their support industries were major employers creating hundreds of thousands of new jobs. Much better paid than subsistence farming or weaving.
If you look at the Scottish censuses for the Glasgow area in 1800s, you will see that about every fifth person recorded there was born in Ireland. Scotland was a particularly popular place to go to work because it was easy and very cheap to get to. (Indeed large numbers of people from Donegal still go there for work to this day).
My guess therefore is that the family earned the money to pay for their passage whilst living and working in Scotland. Stepped migration like that was very common.
Have a look for them in the 1841 & 1851 censuses on the Scotlandspeople site to see what their occupations were. I’d expect things like labourer in an iron foundry or suchlike. That’ll give you a clue.
http://scotlandspeople.gov.uk