I'm kinda new for this, I am planning upgrade my bike from a freewheel type to a cassette type. How can I determine the cogs for the cassette type? My old bike has 8-speed freewheel cogs gears which range from 13T-28T.
You need same number of speeds, same cog spacing and freehub body splines splines. If you don't have any specific need to change the range, you can pick the same sizes. If you want to change the range, there are plenty of answers about that on this site.
For cog spacing and splines, there are two common ones for 8-speed: one for Campagnolo and other for Shimano and everything else. Unless you have a road bike with Campagnolo, you can just pick any 8-speed cassette that is not advertised as Campagnolo compatible.
ojs's answer has already covered the mechanical compatibility issues.
If you're asking about how to get the same gear ratios, basically any 13-28T cassette will have the same, or nearly the same, gear ratios as the one you already have. Essentially, the ratios are chosen to give as even a sequence of gears as possible, and the only real scope for differences is in deciding how to round the "ideal" ratios, which will be fractional numbers, into physically achievable integer numbers of teeth.
Another possible design decision is to have the largest cog quite a bit larger than the second-largest, to give a "granny gear" for steep hills. However, such a cassette would have a largest cog with more than 28 teeth, so you don't need to worry about that. A typical such set up might be the equivalent of a normal seven-speed 13-28T cassette, plus a 34T largest cog.