How do you improve your attack and defence anyway? Like is there another way to learn except playing chess and learning some principles?
improving attack tactics
defense and offense ,,,,,,defense first and think some combo from 1 to 3 up to 5,,the first i did was read books and apply one single variation if you already know that variation then to the next reaD APLLY

You won't checkmate your opponet's king by defending your.
you MUST learn tactics, and you will not learn em from nothing.
you have to practice .
how ? not only by playing.
i try to play at least 5 games of chess a day and i invest more than 5 hours to make my game better. Mostly when i wake up and before i get to bed, when it's calm and i can concentrate, listening to music drinking my coffee.
a good exercise to begin and understand basic tatics and positions (getting used to em) is to place the black king on d5, a rook on d4, and try to fork the rook and king with a white queen. If you don't find any fork, move the rook to e4, and try to find all the forks... Just move the rook all around the king passing by all squares, and try to find all forks with your queen
once you're done with this, you do the exercise with a bishop defending the king, then with a knight, then you switch the white attacking queen for a rook.
And you do the exercise again.
as stupid as it sounds, it really helps to locate forks and skewers in less than 10 sec on the board.
You got to practice to find pins, mates, in given problems that are easy to find on www.chessproblems.com
Good problems solving books can help too.
if you don't ever practice on the board and that you only read theory, you won't learn anything.
when you will be able to find forks , pins, checks, undefended pieces, in less than 10sec - it will be easier to learn endgame tactics. once you know how to set up a good endgame, it will be easier to work on middle game studies.
What i'm trying to say is that you can't play chess if you know nothing about positional play and tactics. even if you're the best defendeder ever.

to me it's not about attacking or defending as if they are too different things it is about making moves that gradually improve your position. If you do that, eventually your position will be so superior that tactical/combinational moves will present themselves. Perhaps your understanding of positional chess is weak if you keep ending up in bad positions.

exactly,
each of your moves has to be both offensive and defensive at same time.
there's no good defense or offense
there'S good positions

I don't know if this helps, but one of the thing that made my largest rating improvement was when I started to 1. Follow a plan, and 2. don't consider attacks against my pieces if I have another stronger one elsewhere.
For example, if my goal is to dominate the center, and the enemy is moving a knight and attacks my bishop for example, I'll search for a way to threaten a piece of his own, in a way that if he takes my piece and in return I take his, he'll be in a worse position.
Prior to doing this, I realized that I was letting my opponent build up a nice position, allowing him to have more available attacks while I was more and more constrained. I though the opponents knew exactly what they were doing, but in reality they simply "reinforced" their position, which naturally led to cramping and destroying my counter-attacking chances.
Note that this will help improve, but only up to a certain point; after that, theory, tactics, positional understanding etc. will still be necessary to get better.
I've recently joined chess.com after not playing chess at all for a while. And after some attempts of playing and some chess mentor lessons, I find I'm still bad at developing attacks. I get better when I'm in a bad situation, but sometimes that's not good enough since its usually to late. So, my question is should I focus on my defensive skills or try to get better at atacking as well?