Study of inclusive production of charmonium mesons in B decays