In older United States English, as recently as the 30's and 40's, a 'flat' referred to one floor of a house that one family or individual resided in. Apartments, however, divided the floors of the houses or building so each floor had several different families or single residents.
"Flat" has fallen out of use in the United States, and we now call all of them apartments, unless they are condos (condominiums. These can be either bought or rented. The condo owner doesn't own the land), duplexes (bought or rented, refers to a house divided in half vertically. One family lives on one side, the other family lives on the other, or townhouses (Same as 'row houses' [a term we don't use here either] and the owner does own the section of land his part of the townhouse is on). Another note: apartments are always rented in the United States, never purchased. If purchasing is an option, the word changes to 'condominium'.
An apartment building is a building that was built as apartments to begin with. It wasn't something else first. I'd be interested to know whether a 'block of flats' has the levels subdivided into separate dwelling units, or if each floor is its own dwelling unit. An apartment building here generally has many dwelling units on each floor.