I would largely pick one place and stay there. Also, if it were me, I would minimize the driving, unless I had a burning desire to visit one particular place. You could easily and happily spend the days in Porstmouth. It has a very nice old downtown with great restaurants, shops, cafes, nightlife. If you have a car, you can easily head south 10 minutes on Rte 1A and have the short but lovely coast of NH. North from Portsmouth, you have the outlet shopping of Kittery just a mile or two across the bridge. You also have a succession of picturesque Maine coast, beginning in York and heading as far north as you like. Staying in Portsmouth, I would opt for the Sheraton or Hilton Garden Inn ( I think that is what it is that just opened.) Both are right in downtown, so you can just walk out to everything.
The other location choices I would consider are:
Ogunquit, ME, about 30 - 40 minutes up the coast from Portsmouth. Another delightful destination, on the ocean. It has less of the small city stuff that Portsmouth has, but you are right on the coast with many hotels to choose from. Walk right out onto the beach, and along the MArginal Way to Perkins Cove, a lovely little fishing village that is very tourist friendly. Agaiin, you are short driving to places up and down the coast, if you must leave such a perfect spot.
Further up the coast is Portland, ME, which is everything Portsmouth is and everything it wishes it is. It is a larger city, the Old Port is larger, there are more arts and galleries, minor league baseball, ferries to the Casco Bay islands, etc. Portland is about an hour, maybe a bit more, from Portsmouth. Again, choose a downtown hotel just for the convenience of not getting in your car unless you absolutely need to. Try the Hilton Garden Inn or the Regency as the two nicest, but I have been very satisfied with the Holiday Inn and Eastland, both a bit of a walk into the Old Port. As with any of these locations, you can drive to a ton of lovely places, and will need to get in the car to get to the beach.
Of course, you could scrap this whole plan and spend the few days in Boston. Try and stay in a downtown hotel. So much is walkable, and the subway system is great. Don't rent a car to get there, and you won't need one once you are there. If you want a city experience, Boston is one of the best. And, you can easily get to the waterfront. There are a variety of ways to get out on the water.
Whichever of these appeals most to you, there will be Forum folks eager to share their local knowledge.