Trying to understand your trip - It looks like
- Arrive at NRT
- Vist Yokohama
- Visit Kyoto
- Back to NRT
If that is so...
The best way from Yokohama to Kyoto is to take the Shinkansen (bullet train) from Shin Yokohama Station to Kyoto Station.
The journey time is just over 2 hours. Departures are very, very frequent.
My recommendation for the trip from Kyoto to NRT is to take a bullet train from Kyoto Station to Tokyo Station, then transfer to the Narita Express.