Discrete coil will require function 05, which is not supported by the WRITEMODBUS or WRITEMB2 command. To change a single bit you will need to read the entire 16-bit channel, change one bit and write back the channel data to the PLC.
Alternatively, you can use some DM locations and writing a 1 to it tells the PLC to turn ON a bit and writing a 0 to it tells the PLC to turn it OFF. Within the PLC program every scan of the custom function you will examine the value of the DM and use SETIO or CLRIO to affect the bit. This is the simplest way if the number of I/O involved is small.