How to include code into functions.php file via a plugin

You can directly create a plugin. Just copy all your codes and put it in a new folder. Plugin will call all the functions.