appendTransactionInstructions if you need to append multiple instructions to a transaction message.
import { address } from '@solana/addresses';
import { getUtf8Encoder } from '@solana/codecs-strings';
import { appendTransactionMessageInstruction } from '@solana/transaction-messages';
const memoTransactionMessage = appendTransactionMessageInstruction(
{
data: getUtf8Encoder().encode('Hello world!'),
programAddress: address('MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr'),
},
transactionMessage,
);
Given an instruction, this method will return a new transaction message with that instruction having been added to the end of the list of existing instructions.