Dead Weight Loss (Tax)
I think you are making it unnecessarily hard for yourself. You can calculate the deadweight loss (DWL) simply as the difference between consumer surplus pre-tax and post tax, and also by adding tax revenue as it is not necessarily wasted if government uses it, so that would be:
$$DWL =  \frac{(A−ap)^2}{2a} -  \frac{(A−a(p+t))^2}{2a} +t(A-a(p+t))= A t - \frac{1}{2} \left( a t (2 p + t) \right) + t(A-a(p+t)) $$
In addition if you have further equations that explicitly model supply you should also add to the deadweight loss the difference between producer surplus pre-tax and post tax but if that is not specified it is common to assume that supply is just flat line (so there is no producer surplus).