How to solve 2nd order inhomogeneous differential equation ivp
The problem is that your complementary solution has the same form as the term on the right hand side. The particular solution you have tried will not work. What you can do is try $$y_p=Ct\cos(2t)+Dt\sin(2t)$$ Then $$\dot y_p=C\cos(2t)-2Ct\sin(2t)+D\sin(2t)+2Dt\cos(2t)\\\ddot y_p=-4C\sin(2t)-4Ct\cos(2t)+4D\cos(2t)-4Dt\sin(2t)$$ Notice now that $$\ddot y_p+4y_p=-4C\sin(2t)+4D\cos(2t)$$ This does not contain $t\cos(2t)$ or $t\sin(2t)$ terms.