Scraping content from yellowpage and write them to a csv file
Your description and your code don't seem to match. In the code I don't see anything related to phone numbers. I also don't understand what "The scraper has the ability to collect all the links connected to all the names." means. With that said, I'm not sure if any of my critique is valid, but here I go any way.

To answer your question about writing to csv, I think you are doing it right. In fact, you are doing it exactly as shown in documentation, so no issues here.

Now I'd like to get into details.

Minor issues


Format your code

Run autopep8 and isort on your code before submitting it. Makes it easier to quickly scan through it.
Use consistent string quoting

It doesn't matter whether you use single or double quotes. What matters is that you pick one and stick with it.
Get rid of useless comments

Consider:

writer.writerow([name, website])  # writing data in a csv file


This comment is virtually useless, because the code right beside it says the same thing. Comments like this explain nothing  and should be deleted.
Variable naming


Spare extra characters to rename res to response
Avoid generic names (e.g. rename item to something like search_result)
Use underscore to separate individual words in variable name (e.g. nextpage →next_page)


Good variable names often eliminate the need for comments. Effort spent on coming up with concise and descriptive names goes a long way towards improving readability.


More substantial issues


This line is way too long.

 website = soup.select_one("#main-header a.website-link").get("href") if soup.select_one("#main-header a.website-link") else ""


Consider rewriting it as an ordinary if statement. Save the result of soup.select_one(...) into a variable to avoid repeated function call.
Use of recursion in get_links is confusing. Consider rewriting it using a while loop.


Some things I might have misunderstood


There doesn't seem be any need to use requests.Session and on top of that reset headers before every call to get. If you really need a persistent session, it'd be a good idea to leave a comment explaining why.
In your code you seem to be only grabbing name and website for each search result. If that's the case, loading the details page for each result is redundant as all desired information is present in the search results themselves.