List ranges and the total count based on condition
You were close with what you had. Just needed a couple of changes.

Declare @VID INT  = 1

    ;WITH Tmp as
    (
      SELECT 
            TM.CharToAdd as Prefix, 
            sno,
            sno - ROW_NUMBER() OVER(PARTITION BY TM.CharToAdd ORDER BY sno) as grp
      FROM dbo.TblDetails TD
      LEFT JOIN dbo.TblMaster TM on TM.[SID] = TD.[SID]             
      WHERE isIssued = 0 and isUsed = 0 
            AND  (TM.VID = @VID OR TM.VID IS NULL)
    )
    SELECT  Prefix,
            MIN(sno) as RangeStart,
            MAX(sno) as RangeEnd,
            COUNT(*) as [Count]
    FROM Tmp
    GROUP BY grp, Prefix


You need to partition on TM.CharToAdd to make the counter restart for each prefix value and you need to change AND  TM.VID = @VID to AND  (TM.VID = @VID OR TM.VID IS NULL) if you want the rows from TblDetails that does not have a match on SID in TblMaster.