It's almost certainly going to be a violation of the YouTube Terms of Service, paragraph 5(B):
Content is provided to you AS IS. You may access Content for your information and personal use solely as intended through the provided functionality of the Service and as permitted under these Terms of Service. You shall not download any Content unless you see a “download” or similar link displayed by YouTube on the Service for that Content. You shall not copy, reproduce, distribute, transmit, broadcast, display, sell, license, or otherwise exploit any Content for any other purposes without the prior written consent of YouTube or the respective licensors of the Content. YouTube and its licensors reserve all rights not expressly granted in and to the Service and the Content.
Although it's a violation of the ToS, that doesn't necessarily tell you whether it's illegal. The answer to that will depend on your jurisdiction, and even with your jurisdiction, it may be hard to answer the question. My understanding is that in the United States, there's still an open question as to whether simply violating the ToS would constitute a violation of the Computer Fraud and Abuse Act or any of the various state laws involved.
There have been some good cases suggesting that it is not, but the Supreme Court is currently deciding whether to review one of them.
Beyond that, it may also be a copyright violation. It's not entirely clear whether this would constitute fair use as a copy for "personal use," as you don't already own a copy of the video. Nor does it seem to be "time-shifting," as YouTube videos are already available on demand.
I can see a good argument being made either way, but unless having them offline is truly necessary for the use you're envisioning, I'd probably bet against fair use and expect this to be considered a copyright violation.