Below is your family in 1841 and 1851 from the Free Census site : it looks from the 1851 as if both John and Margaret were born in Kirkconnel in Dumfries-shire. This is the website.
www.freecen.org.uk/You probably need to get on the Dumfries-shire list.
Piece: SCT1841/610 Place: Old Cumnock -Ayrshire Enumeration District: 8
Civil Parish: Old Cumnock Ecclesiastical
Parish, Village or Island: Old Cumnock
Folio: 0 Page: 3
Address:
Longmore SCOTT John M 25 Ag. Lab. Ayrshire
SCOTT Margaret F 25 Ayrshire
SCOTT Mary F 8 Ayrshire
SCOTT Margaret F 6 Ayrshire
SCOTT David M 4 Ayrshire
SCOTT
Isabell F 1 Ayrshire
Piece: SCT1851/613 Place: Sorn -Ayrshire Enumeration District: 4
Civil Parish: Sorn Ecclesiastical
Parish, Village or Island: Sorn
Folio: 0 Page: 14 Schedule: 43
Address: Sorn Village
SCOTT John Head M M 40 Labourer Dumfries-shire - Kirkconnel
SCOTT Margaret Wife M F 40 Labourer's Wife Dumfries-shire - Kirkconnel
SCOTT
Isabella Dau U F 11 Scholar Ayrshire - Sorn
SCOTT Elizabeth
Dau U F 8 Scholar Ayrshire - Sorn
SCOTT Adam Son U M 6 Scholar Ayrshire - Sorn
SCOTT John Son U M 4 At Home Ayrshire - Sorn
SCOTT Janet
Dau U F 5m At Home Ayrshire - Sorn
Best,
Mary