Problem reading a char or string

But how could I have the - between each group of 3 numbers ?

By printing 3 characters, then a dash, then three more...

If you need the referencePDU array to contain the dashes (I doubt that you do), you could add a dash after adding customKey, when n is 2, 5, and 8.