In Episode 6, it is stated several times that Tywin's family-line will end if Tyrion dies or goes to the Night's Watch, and Jaime doesn't get married - which means none of them would have children. Now I wonder: There is still Tommen and Myrcella who are Cersei's children and thus continue Tywin's family line even if the children are considered to be Robert's children. So what is the problem about?
Jaime, by the vows sworn of the Kingsguard, can not have children or inherit titles/land (like the Night's Watch). This means that he can not continue Tywin's line.
Obviously, Tyrion can not continue it either if he dies or is sent to the Night's Watch.
So this leaves Cersei and her children. Now, Westeros (aside from Dorne) is a patriarchal society. Meaning titles, land, etc. generally flow from father to sons (in order of age). When women marry, they give up their former houses and take the house of their husband. This means Cersei herself can not continue Tywin's line.
To answer your question itself, concerning Tommen and Myrcella, the reason they can not continue Tywin's line is obvious if you use their full names: Tommen Baratheon and Myrcella Baratheon. They no longer continue the Lannister (especially Tywin's) line due to their 'father' in Robert Baratheon.
Now, if the truth about their parentage is completely revealed and recognized by the outside world, then they can continue the Lannister line. But this would, at the very least, cause them to abdicate the Iron Throne.
The only other alternative is if the High Septon absolves Jaime of the vows he took for the Kingsguard. This is possible, as Tywin mentioned wishing for it to be done, but Jaime refuses to do so.
Keep in mind that this does not mean the Lannister line will end if none of Tywin's children can continue it. The Lord of House Lannister will simply transition to Kevan Lannister or whoever is next in line.
Edit: I should also mention the fact that Cersei still goes by Cersei Lannister as opposed to Cersei Baratheon. There appears to be a special case in royal marriages that allow the queen to keep the last name of her former House. Margaery Tyrell and Elia Martell (wife of Rhaegar Targaryen) do the same. Note that this typically does not happen for normal Lords (see Catelyn Stark, etc.). But the children of the royal marriage continue down the father's line.