Shell model approach to construction of a hyperspherical basis for a identical particles: Application to hydrogen and helium isotopes