Constructing graphs with given spectrum and the spectral radius at most 2