This paper considers waveform design for MIMO radar to synthesize a desired beampattern under similarity and constant modulus constraints. Generally, the constructed framework is a complex nonconvex optimization problem, which is difficult to solve directly. To tackle this problem, we convert it into a neural network-based learning problem. In particular, an objective function is developed to characterize the similarity constraint that makes the design waveform have good characteristics similar to the reference waveform. Then, we design a joint loss function for optimizing the transmit beampattern and waveform similarity, which allows the designed waveform to have better detection performance. Numerical simulation results show that the proposed method has better performance than the existing state-of-the-art method.