Primary, Secondary & Tertiary Haloalkanes
A haloalkane is classified as primary, secondary or tertiary NOT because of where the halogen is attached. It is all about the Carbon on which the halogen is attached.
We will call the carbon on which the halogen is attached, the key carbon, and in these examples, it is in red.
Primary Haloalkanes
Notice the red key carbon, where the Cl is attached.
1-chlorobutane

Only one other carbon, the green carbon, is attached to the key carbon.
Hence this is a primary haloalkane.
N.B.
In this example, even though the red key carbon is not attached to another carbon, this is still called a primary haloalkane.

chloromethane
Secondary Haloalkanes
Notice the red key carbon, where the Cl is attached.
2-chlorobutane

There are two other carbons, the green carbons, attached to the key carbon.
Hence this is a secondary haloalkane.
Tertiary Haloalkanes
Notice the red key carbon, where the Cl is attached.
2-chloro-2-methyl-butane

There are three other carbons, the green carbons, attached to the key carbon.
Hence this is a tertiary haloalkane.
It does not matter how complicated the molecule may appear. Just identify the key carbon, and then count how many other carbons are attached to it.