Conventional regular pilot (RP) scheme is not applicable for ultra-reliable and low-latency communication (URLLC) due to the impact of finite blocklength. In this paper, we propose to use generalized superimposed pilot (GSP) scheme for URLLC transmission in massive multi-input multi-output (mMIMO) systems. Distinguishing from the existing superimposed pilot (SP) scheme, the GSP scheme eliminates mutual interference between the pilot and data, where the data length is optimized, and the data symbols are precoded to spread over the whole transmission block. With the GSP scheme, we first formulate a weighted sum rate maximization problem by jointly optimizing the data length, pilot power, and data power and then derive closedform results, including optimal data length and achievable rate lower bound with maximum-ratio combining (MRC) detector. Based on the closed-form results, we provide the corresponding iterative algorithm where the problem is transformed into the geometry program format by using log-function approximation method. Finally, the performance of the RP, SP, and GSP schemes are compared through simulation results, which reflect the superiority and robustness of the GSP scheme in URLLC scenarios.