On purchase (say, £100 net, £17.50 VAT, £117.50 paid):
DR Purchases £100.00
DR VAT debtor £17.50
CR Bank £117.50
On recovery of the VAT from HMRC:
DR Bank £17.50
CR VAT debtor £17.50
If you know your double-entry bookkeeping, this should be enough for you to work out what is required and where you went wrong before (if anywhere).
If not, unfortunately I cannot tell you the Sage codes to use as I do not use Sage myself. Others here might be able to help.