What you are describing is a common scenario. You could do this using the built-in Android NdefMessage and NdefRecord classes, however I've written a lib which simplifies things: NDEF Tools for Android.
Might I suggest the following approach, using the External Type record?
AndroidApplicationRecord aar = new AndroidApplicationRecord();
aar.setPackageName("org.my.app");
Message message = new Message(); // org.ndeftools.Message
message.add(androidApplicationRecord);
message.add(new GenericExternalTypeRecord("org.my.app", "username", myUsernameBytes);
message.add(new GenericExternalTypeRecord("org.my.app", "password", myPasswordBytes);
NdefMessage toWrite = highLevel.getNdefMessage();
Alternatively you could create a byte format for both username+password and then use a single External Type Record. For the later Android versions, you could actually do the above using the built-in helper methods (but then you'd have to do the parsing manually).
See these example classes for the actual reading/writing to a tag.