For getting into a flow of any activity, you need to have these 3 ingredients:
1. Clear goals: You need to have a clear purpose for the activity, I want to finish this story, I want to climb this rock, I want to play this song on guitar.
2. Something meaningful to you: You should be doing something meaningful to you in life. It can be something interesting or something which you live to earn money etc.
3. Edge of your abilities: You should be doing it at the edge, not very easy otherwise it will become dull, not very difficult otherwise it becomes demotivating. It should be on the edge of both.
In the state of flow your ego vanishes, you have merged with the task and you don’t bother about the time engaged in the activity.