While Washington Irving's true purpose in writing "The Devil and Tom Walker" might never be known, we can deduce from the times and the themes of the story what it might have been. For example, because of the strong Puritan influence on literature during the 1800s, it is easy to show how greed and wealth act as opposites to godliness and charity; Tom Walker is a greedy man and even in his "repentance," which is only lip-service, he acts greedy, leading directly to his personal destruction.
Another purpose is to modernize the legend of Faust; both stories concern a wealthy man who makes a deal with the devil, is successful for a time, and is then undone; while some versions of Faust end with redemption, "The Devil..." always ends with Tom Walker's destruction. Irving may have intended to show that this life is fleeting, and sins will always be punished, even if it takes time.
In place of gold and silver his iron chest was filled with chips and shavings... such was the end of Tom Walker and his ill gotten wealth. Let all griping money brokers lay this story to heart.
(Irving, "The Devil and Tom Walker," loa.org)
Here, we see that Tom Walker's desires made no difference in the end. His money may have never been real; "chips and shavings" are as much use against death as gold and silver. His greed caused his downfall as much as his initial deal.