Federal law (52 U.S. Code §30114, originating in the Federal Election Campaign Act of 1971) specifies permitted uses of contributed funds. Aside from ordinary campaign expenditure, and donations to other candidates and so forth, these include uses:
(3) for contributions to an organization described in section 170(c) of title 26;
...
(6) for any other lawful purpose unless prohibited by subsection (b) of this section.
Subsection (b) is the exclusion of spending for personal use. So that leaves charitable contributions within the meaning of the cited section, and "any other lawful purpose", which intuitively can cover lots of possibilities.
A charitable contribution can be made to a government entity, as 170(c)(1) covers gifts to:
A State, a possession of the United States, or any political subdivision of any of the foregoing, or the United States or the District of Columbia, but only if the contribution or gift is made for exclusively public purposes.
Therefore, a candidate can certainly hand over some excess cash as a gift to the Federal government, for example. They do not need to rely on "any other lawful purpose" since those contributions are explicitly called out as being possible. The question asks about "ventures that benefit the country at large". Several such ideas are probably encompassed in the charitable-contributions option.
In the specific question, though, it is not clear to me how a private person would "pay down" the national debt. Treasury bonds, notes, etc. are basically agreements between the Treasury and the bearer (and for several decades have been "non-callable", so there's no early repayment option). A third party can't interject themselves into that relationship, to pay on the government's behalf outside the terms of the bond. What they could do is buy some T-bonds. At that point, I don't know if it's actually possible to forgive that portion of the debt - people generally don't want to do this! But they could give the bond back to the government, which already holds a lot of its own debt. In low volumes (i.e. they are not trading enough to affect the market in securities, or have other macroeconomic effects) this is a roundabout way of just giving the government some money, a thing which the person could have done anyway with less rigmarole.
I believe that in practice, federal candidates have tended to give surplus money to other candidates, party organisations or PACs, rather than to charity in any significant volume. They might also hold on the money for a future race of their own.
There can also be other types of associations between charities and PACs (not connected to a specific candidate). A notorious example is the Walmart "PAC for Responsible Government" or "WALPAC", which lobbies and donates on issues dear to Walmart's corporate heart. Employee donations had been solicited on the basis that the company would match each contribution with double that amount to a charity, the Associates in Critical Need Trust (ACNT), also run by Walmart. In 2015, following complaints, the FEC decided that all this was fine. There are many other company PACs which do charitable matching like this, although not typically with a 1:2 ratio and to such a tightly linked cause. And a PAC itself is able to make charitable contributions.