By “line up in platoons” I believe OP is referring to a traditional double-rank battle line infantry formation, which sees the soldiers marching at least two rows deep, shoulder-to-shoulder towards an enemy position. Many of these tactics came from William J. Hardee’s ‘Rifle and Light Infantry Tactics’ published in 1855, which served as the basis for much of the instruction for American Civil War infantry officers. This text, along with Winfield Scott’s ‘Infantry Tactics’ stressed the importance of massed fire to drive away enemy combatants from a fixed position. The idea was that muskets or rifles could be best put to use when their admittedly poor accuracy was concentrated and delivered with overwhelming force. Even rifled barrels delivering bullets instead of musket balls couldn’t be counted on to hit much beyond 50 yards when the smoke of artillery and black powder obscured a battlefield.
So to answer OP's question, there’s this very reasonable, practical, well-tested tactic in the Civil War that sees armies massing their infantry, getting right up to an enemy position, and pouring wave after wave of rifle fire into a position. It seems crazy to modern observers, but in reality, this really was the best way to use rifle fire effectively against a massed enemy. Now, one might ask when soldiers started to realize that just standing out in the open and shooting at massed infantry that was also shooting at you was a bad idea, and the answer to that is: immediately. Almost any soldier of the period, if given the opportunity, immediately started digging into a position or creating makeshift fortifications so that they could fire from a concealed position. Naturally, this was only if they were on the defensive; if a soldier had to take an enemy position, there was no digging in that could be done, and they’d march up, mass their fire, and try to drive the defenders off.
With any luck, artillery fire from behind one's own lines would soften the defenders up before they got up to their works, but in the Civil War, to make the best use of infantry fire, they had to mass it. The accuracy of the rifles and poor visibility on the battlefield necessitated this.
One breakthrough that did occur in this regard was made during Grant’s push south in 1864. A young Major named Emory Upton developed a tactic that was literally a half century ahead of its time (it would be put to use widely in World War I). Upton was in Grant and Meade’s army when they faced Lee at the Battle of Spotsylvania Courthouse, and Upton knew a thing or two about fighting in that era. He was a veteran of the Seven Days, Fredericksburg, Antietam, and Gettysburg (to name just a few of the big ones), so he’d seen practically every evolution of tactics throughout the war. When he got to Spotsylvania, he saw that Lee’s troops were dug in hard at a spot called “The Mule Shoe,” much like the trench warfare of WW1 (trenches, obstacles, converging fields of fire). He had a revelation: why not just run towards the enemy lines, wait to fire until right on top of them, then just pour into the enemy trenches, creating a breach that could be exploited for following units.
It was a tactical revolution for infantry movement. Massed fire was still used, but the approach to a position, and the follow up after unleashing a sheet of fire, changed. Instead of marching in double-rank battle line and exchanging fire with an enemy (trading shots from an exposed position while your enemy huddles behind concealment), you run up, hit them with a hard volley, then go to the bayonet. After some fits and starts, the tactic became the go-to strategy for infantry formations going forward, and did indeed represent a true breakthrough in tactics that eventually moved armies away from the battle line formation when conducting offensive operations.
You can read more about Upton in Bruce Catton’s ‘A Stillness At Appomattox’ and ‘Grant Takes Command’ or more briefly in James McPherson’s ‘Battle Cry of Freedom.’