Change the number of bricks to fit. The answer to your second question is that you can't really. In practice, 4m is quite a long way and you probably wouldn't see a completely featureless brick surface bigger than that in the real world so you can hide the seam with a natural split in geometry or slap a tree in the way…
Bricks are actually an inconvenient size for texturing so you won't be able to fit a 4m tiling section of brick wall onto a texture sheet perfectly. Round the brick size up or down to get a whole (even) number, map it to 4m of wall and you're done. If your geometry doesn't fit, change the geometry. With stuff like bricks,…