Can TDIU, P&T, SSDI Veterans earn passive income by writing a book, investing in stocks, or buying properties?
The word passive would best describe something that requires no effort. Your 3 examples are all real work. Writing a book, investing in the market and buying properties in hopes of a profit are all examples of work or 'gainful employment' and those who earn their livings at such endeavors wouldn't like to hear that you think any of it is passive.
So...no, these are not things you can do to earn income other than income that is less than the poverty level.
What you might call passive income, that income that is allowed, would be winning the Lotto, inheriting poor old Aunt Gertrude's fortune, marrying a wealthy partner who gifts you with riches or stumbling across a pirates chest of booty.
The VA is more forgiving than the SSA. An SSDI beneficiary has to be careful of even doing volunteer activities because the SSA may see that as an indication that the beneficiary is able to work. The VA allows volunteering and when you enter your VA facility, most of the volunteers you'll meet there are disabled vets.
Be careful with any earned income if you're rated as TDIU. The VA is tracking your IRS and SSA accounts and if you raise suspicions, you'll get a request to complete a VA form 21-4140 and you could lose the 100% rating.