A.M.D.G. is an abbreviation for the Latin phrase, Ad majorem Dei gloriam or 'To the greater glory of God'. The phrase and abbreviation are of uncertain age and origin,
but is closely associated with the Jesuits whose motto it is. It is said that Pope John Paul II puts these letters on the corner of the first page of each letter or essay he writes. It is used by faithful Christians to dedicate a work or piece of writing to God.
Thanks to Tiefling.