There are multiple questions to address here:
Why do we have political parties?
Because they are effective.
A political party, loosely defined, is a group of similarly minded people that have an agreed upon agenda or goal in government.
By agreeing to cooperate with a group of people, there is more capability in getting the job done. This is not unique to political parties. Other answers have covered how the cooperative aspect is beneficial.
Another element to why we have parties is public perception. People have a tendency to agree with someone that many other people also agree with. By organizing a group behind fewer concepts, you grant that concept more authority by claiming the people of the party back it.
Another reason, safety. Political parties are often sought as a means for protection. They are able to help defend each other from aggressors.
The other issue is, if everyone is just going to vote along the party line, what's the point of even having members of parliament? One could easily program robots to vote in their place.
This question's root comes from an entirely different concept as to why the party exists in the first place. Voting party lines is common, but not absolute. In many cases in many governments there are examples of individuals voting against the party.
Here, the point is to advance an agenda you agree with or prevent something you disagree with. A political party frequently has a member or group of members that typically try to convince everyone else in the party it is in their best interest to vote a certain way on a topic. In the US, this is typically called the Whip. For that job, it is also about tallying the vote counts prior to the vote.
This is all part of the party strategy. If a party doesn't consistently vote together, it is not viewed as a cohesive or strong party, so it may be difficult for it to gain power.
According to Wikipedia there're indeed countries where all lawmakers are independents (Kuwait & Niue). Why isn't this more widespread? Why do other countries use political parties - what is the advantage?
A common binary spectrum used to describe lawmakers would be to place them on a scale of conservative or liberal, however they are defined. While this binary spectrum may not be very accurate in many instances, it does allow some level of measuring candidates. Even in instances where every lawmaker is independent, the are publicly associated with groups of ideals or values.
This naturally lends itself into creating political parties. Where a candidate is able to leverage those associations.
Having everyone independent in large communities leads to several potential problems. In smaller governments, this may be acceptable, but might not win favor over the many advantages parties afford.