Traditionally, Deuteronomy, the fifth book in The Bible, was held to have been written by Moses (along with its four predecessors). In fact, the book was written much later than Moses would have been alive – eight to nine hundred years later, in fact.
Different sections of Deuteronomy were written at different times, and not in chronological order, either. The majority of the book is a very detailed legal code, including all sorts of prohibitions, punishments and proscriptions. Some of these are purely religious in nature, others detail crimes and sentences, and still others concern civil matters such as marriage. And, of course, it called for the complete destruction of the Amalekites.