if people like the show, they'll be more inclined to buy the book he has already written about it. if the show stays on the air, he has more likelihood of continuing to write novels about it. if the show fails, there's less of a market for his product.
That's not really accurate on a few counts. For one thing, Mack has recently gotten a fairly high-profile deal for an original novel series (it's a historical/military/urban fantasy thing, if you're curious), so he's less wedded to Star Trek for making his living than he's ever been. Additionally, the performance of this particular novel is monetarily irrelevant to him; long-term, he has a proven track record of hits, so one dud wouldn't sink him, especially if it could be blamed on the parent show taking a dive rather than the quality of the book itself.
In the short term, authors are paid in advance to write books. The reason it's called an "advance" is because the money is considered to be paid out of the royalties that will be made off the book once it's released. Authors don't make any money based on sales until the book has sold enough that the author's share of the revenue exceeds the amount they were paid in advance. At that point they've "earned out," and only then start receiving royalties. The thing is, with a licensed novel, there are more hands getting a slice of the book-revenue pie; in addition to paying the publisher, and the bookstore, and the author, they also have to pay the people who own Star Trek, so the author's slice is thinner, but advance they're paid isn't correspondingly smaller (because it's still the same amount of work to write a Star Trek novel as it would be to write a Technically Original Space Adventure). Since each book sold doesn't go as far as paying off the author's advance, it's unlikely the advance will ever be paid off in full for any given licensed novel, and even when they do, the royalties are typically on the level of a few bucks every few months. Not the kind of money that'd make someone stick their neck out and risk their reputation by going ham for an unreleased show when the can just keep quiet and wait out the FUD.
I'm sure David Mack would be personally disappointed if nobody bought "Desperate Hours," but in terms of the crass monetary motivation you suspect, the sales don't really matter. He's already been paid for it.