Method for producing a device for muffling sound or catalytic treatment of exhaust