The man accused of hiding out with a gun near Donald Trump’s Florida golf course in an apparent bid to kill the former president wrote a letter months earlier describing an “assassination attempt”, prosecutors say.