If you're asking if that's the correct way to define and call a function, then yes. You don't HAVE to separate it into functions, but it makes it easier to read and maintain if it's broken down into logical chunks.
I'm a little unclear on something: Is the query only returning one story or many? You say that you want to use $story['headline'] as the page <title>, but you set and display $story in a while loop, implying that the database is going to return more than one story.
If you're only displaying one "story", then just connect to the database and put the results in the variable $story before the "include('header.php');". That way, $story['headline'] will have been initialized for header.php to use.