Newbies in StarCraft 2 are often gun shy. I was guilty of it myself when I played the original StarCraft. The temptation is strong to wait for just one more unit, one more upgrade, one new building to be better than your opponent. Unfortunately, this is a good way to lose.
Your opponent has just as much time as you do to upgrade and pump out units. You aren't getting ahead, you are simply delaying conflict.
When a player only defends it is called turtle-ing. You can not win if you only defend. The winning condition for StarCraft 2 is to destroy all of your opponent's buildings. It won't ever get accomplished if you don't leave your base.
There are two main advantages to staying aggressive with your units.
With a constant stream of attacks you decide when to battle and where to battle. You can be a constant thorn in the enemy's side. It keeps your opponent off balance. They constantly have to react to you because you have control over all of the battles. They never quite have time to regain their footing.
I have had games where I win because I constantly attack the enemy and - even though my opponent is stronger or has a better economy - they quit because they can't stand the harassment.
They may eventually counter you, but until that time the battles are taking place in their base and messing up their units while your base is sitting pretty and undamaged.
If you push all the way into the enemy base there are two strategies on what to attack. You either want to go for their tech or their economy. If you attack their tech buildings they are unable to build higher tier units. If you skip the buildings and go for their resource harvesters you can cripple their economy to the point where they will never catch up to you for the rest of the game. Target one or the other, but make sure you have a target in mind, if you let your units attack whatever they want you are wasting their efforts.
If your enemy does attack you first and you repel the attack, strongly consider executing a counter-attack. If you do decide to launch a counter-attack don't wait, don't recoup, take all your offensive units and attack their base right away. Commit all your forces and you have a chance to win the game right away. I win at least a third of my games by counter-attacking immediately after I defend against an enemy attack.
Remember, the more aggressive you are the more you are in control of the battles.
Your other advantage with aggressive tactics becomes map control. By constantly attacking your opponent you can keep them confined to their initial base. If you harass them enough they'll be afraid to expand to any other base location.
It may not even be necessary to push your units into their base, posturing can be just as aggressive as attacking. You may be able to scare them off with an initial push and then simply leave units outside their base to keep them bottled up inside. Siege tanks work especially well for this purpose if you play Terran.
When you have your enemy trapped in their own base you can use any - and all - of the resource fields on the map. This allows you to out-macro your opponent. Your economy will dominate theirs. If you simply have more resources you can make more units and make them faster. It takes a little time to expand to a bunch of bases, but it can be the deciding factor of a game.
If you have a bunch more bases than your opponent has you should win almost every time.
Idle units won't do you any good. An attacking unit is a happy unit. Even keeping units in the middle of the map or outside the enemy base can be used as an aggressive posture. Use the units you make, attack the enemy, and - above all - stay aggressive.