The Federal Reserve delivers its profits, after expenses, to the US Department of the Treasury. The Federal Reserve also holds several trillion dollars' worth of government debt. So when the securities that they hold reach maturity and the government pays the maturity value on them, does the Federal Reserve just pay it right back to the Treasury Department, effectively canceling the debt?
The repayment itself is not part of the profit. That is just treasury returning back to Fed the money they borrowed. For example, when that treasury was originally issued and sold at \$1000 (assume face value is also \$1000 the government received \$1000 dollars from Fed, and when the government repays the money to the Fed, that is what effectively 'cancels' the original loan. If Fed would forward that money to treasury that would effectively be equivalent of Fed just giving \$1000 forever.
However, the interest that government paid on those treasuries will be part of Fed's profit. So any interest government pays will go back to the treasury, meaning that effectively the government pays the interest rate to itself.