You can take raptisagar till LKO and from there any train to haridwar and from haridwar there will be ample of busses to badrinath Direct but to kedar no direct road, Till gaurikund by bus and from Gaurikund 14 km trekking!!!
Or else second option as said by krishnan sir