They would have needed fire to cook at least but how was it possible ?
Ordinarily fire was borrowed. In many places, like Scotland, there were rituals and customs where once a year all the fires would be put out and then renewed from one place, a sacred fire. To light fires while traveling there was a small kit, called a tinder box, that had a flint and steel in it. Here is a passage in the "The History of the Town of Lyndeborough" that is relevant:
It was not until 1835 that friction matches were used in Lyndeborough. They had been invented in England a few years before, but were so costly in those days when money was scarce, that they were not freely used. Therefore, for the first century in the history of the town, the flint and steel and tinder box method was the only one by which to produce fire. But this was a very troublesome way. Skill was required to strike the spark, catch it in the tinder and blow it into flame. There was a flint and steel in most families, but their main reliance was in care that the fire should not go out. It was carefully covered every night. The glowing coals were raked together and covered deep with ashes, and in the morning this heap of ashes would be opened, dry wood laid thereon, and soon a good fire was burning. But sometimes in spite of all care it would go out, and then some one would go to the neighbors to borrow fire. One old lady who lived on the mountain has told the writer of going to John Ordway's, who lived where Charles J. Cummings lives now, to get fire. Once both families happened to be destitute of the necessity on the same morning, and she had to go over to Robert Badger's, where Harry Richardson now lives, to get coals.
There is a certain kind of woody shrub that when dry and rubbed together will quickly make a fire. I forget the species. Such plants were used before flint and steel were common.
In ancient Gaelic custom there was a holiday pronounced "Shabane", which occurred on November 1, meaning the "Feast of Fire". On this day all the fires were put out and each householder would have to buy fire from the sacred temples and altars of the druids, thus each hearth was spawned from the holy fire. (See "Old Scottish Customs, Local and General" by Guthrie) After Christianization this holiday was turned into "All Saints Day", the day before being "all hallow's eve" or Halloween, as it is now known.
As others have mentioned, early peoples could have "borrowed" fire from natural fires, typically caused by lightning strikes. However, a more dependable source of fire was provided by simple tools.
Rubbing two sticks together to produce heat that eventually ignites dry tinder is a common technique taught in survival classes even today. Flint is also a well known fire starter.
Starting a fire with sticks (Video)