System and method for integration of renewable energy and fuel cell for the production of electricity and hydrogen