In this paper, we present a novel stroke reconstruction algorithm for 3D cursive script using an inexpensive accelerometer and magnetometer. By imposing constraints based on ergonomics and habitual motions, the proposed algorithm can accurately estimate the orientation of a handheld device under both static and dynamic conditions. Then, the gravitational force is subtracted from the measured acceleration force for the stroke-induced acceleration, the values of which are integrated twice over time to obtain a position trajectory. The reconstruction performance is evaluated by comparing estimated stroke trajectories from a magnetometer-aided inertial measurement unit (mIMU) with those from an optical motion tracking system for alphanumeric cursive scripts. Furthermore, the recognition rates of the proposed algorithm and other conventional algorithms are compared. The experimental results reveal high accuracy in both stroke reconstruction and recognition rates.