idk to attack king properly



Look at typical plans in your openings: Each opening has standard plans — studying annotated games in your favorite lines helps you learn them.

You only want to attack the king's position when you have a good position, or there are major weaknesses in the king's position. Generally you don't want to attack the king if you don't have good control of the center, you are developed, and your king is safe. This can only be done when your pieces are in a good position (something that you need to work on), and your pieces are working together (I am not talking about just two pieces, I am talking about your entire army) toward that goal. Also if the king is well defended, then an attack on the king may put you in a worse position. For me I generally will only attack the king if I have good control of the center and I am able to bring in at least three pieces into the attack, or I see a glaring weakness in my opponent's king safety that I can exploit. If I don't have those things then I generally don't attack the king. Of course I calculate out any attack on the king before I do it, and won't attack the king if I don't see a benefit to it in the current position. I will often try to induce weaknesses in my opponent's king safety that may eventually allow me to have a successful attack on the king though. So doing things that induce my opponent to push a pawn in front of their king is a good idea, or if you can force doubled pawns in front the king then that is also good. When doing these things you will want to do them in a way that will not cause problems in your position.
If I don't have a good enough position to attack the king then I won't, or the position may not call for an attack on the king. There are many winning advantages that don't involve attacking the king to exploit (aside from checkmating the king in the endgame obviously). If your position is not good enough to attack the king then attacking the center to get great control over it, or decreasing your opponent's control over it is a good way to possible get a good enough position to attack the king.
Some basic guidelines for attacking the king:
1. Is to attack with multiple pieces (ideally at least one more piece then your opponent has defending the king)
2. Don't trade pieces when attacking unless it has a purpose. Don't trade pieces to trade pieces.
3. If you don't have good control of the center (like borderline dominating), or the center is locked up with pawns; then attacking the king is generally not the right idea in that position. So a good idea would be to attack the center instead.
4. Only attack if there is a weakness you can exploit.
5. Have purpose behind your attack. Don't just attack to attack. What is your goal with the attack. Is it to checkmate the king? Win a material advantage? Create a long term weakness that you can exploit? There many reasons to attack the king that don't result in checkmate.
Here is my analysis of one of your games:
You will also need to learn about chess strategy, and positional chess to attack well so you can know when you have a position to attack the king, and when you do not have a position to attack the king, or when to do it.
Here are some resources to help you learn about attacking:
Chess Vibes 18 Attacking Principles
Chess Vibes How to Attack the Castled King
Chess Vibes Strategy and Tactics Playlist (Has a lot of good videos to help you learn about the middle game)
Chess Vibes Book Club Logical Chess Study (Another good playlist that can help you learn about strategy, tactics, and attacking)
Hope this helps.

If you can't mount a decisive attack the king, you can at least look for ways to threaten it in a way that benefits you. For example, you might attack an unprotected pawn and threaten checkmate at the same time; your opponent must stop the checkmate, and then you take the free pawn.

search 'attack'...
Good Chess Books for Beginners and Beyond…
https://www.chess.com/blog/RussBell/good-chess-books-for-beginners-and-beyond