they cover the side walk and have like metal bars on the edge facing the street
They are called sidewalk sheds or sidewalk bridges and are used to protect pedestrians from falling debris. Usually this is a construction site, but can be where the building is in bad shape and inherently dangerous.
The scaffolding is connected to a building under repair or being built. It's used either to provide support for the building while it's being repaired (or built) or to protect people in the sidewalk below, or both.